WordPress.org

Ready to get started?Download WordPress

Forums

Custom post type pagination with WP-Pagenavi (2 posts)

  1. Morhaus
    Member
    Posted 2 years ago #

    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%".

  2. Morhaus
    Member
    Posted 2 years ago #

    I changed the maximum number of posts per page in the configuration panel and it seems to fix the problem.

Topic Closed

This topic has been closed to new replies.

About this Topic