WordPress.org

Support

Support » How-To and Troubleshooting » Custom post type pagination with WP-Pagenavi

Custom post type pagination with WP-Pagenavi

  • Hello everyone.
    I’m trying to make a functionnal archive for a custom post type called “video”, using the plugin “WP-PageNavi”. Here’s the content of the file “archive-video.php” :

    <?php
    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    $args = array(
        'post_type' => 'video',
        'posts_per_page' => 6,
        'paged' => $paged
    );
    $video_query = new WP_Query($args);
    if($video_query->have_posts()){
        while($video_query->have_posts()){
            // Loop content
        }
    }
    wp_pagenavi(array('query' => $video_query));
    ?>

    The URL of the custom post type, “localhost/sitename/videos” (I changed the rewrite slug), displays well, while the URL of the custom post type’s page 2 (for example), “localhost/sitename/videos/page/2”, displays the index (Page not found).

    My permalink structure is “/%category%/%postname%”.

Viewing 1 replies (of 1 total)
  • I changed the maximum number of posts per page in the configuration panel and it seems to fix the problem.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom post type pagination with WP-Pagenavi’ is closed to new replies.
Skip to toolbar