I have a custom post type called "internpage", here are the args:
$args = array(
'label' => __( 'Interne Seite', 'text_domain' ),
'description' => __( 'Seiten interner Bereich', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'author', 'page-attributes', 'revisions' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 70,
'menu_icon' => 'dashicons-lock',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
The template is called "single-internpage.php". On one of these pages I have a custom loop who shows posts of another custom post type ("internpost"):
$args=array(
'post_type' => 'internpost',
'posts_per_page' => 3,
'orderby' => 'date',
'paged' => $paged
);
$wp_query = new WP_Query($args);
if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();
the_title();
endwhile;
endif;
posts_nav_link();
With this I display the latest 3 posts of this custom post type ... inside the single-internpage.php.
This works but I can't get the pagination running. When I hover the posts_nav_link like "next page" firefox shows me that the adress is".../page/2" which is cool. But when I click on this nothing happens, the page reloads and the URL stays the same (without ".../page/2").
When I put the same loop in a normal pages template of e. g. the contact page, it works.