2

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.

1

This question seams to be the same as this one

posts_nav_link on single post template

hope that helps :)

  • Thanks. I think I have to use a page template or an archive page instead. – Henning Fischer Jan 17 '17 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.