Support » Plugin: WP-Paginate » Incorrect Number of Pages with Custom Post Type

  • Trying to figure out what is wrong with my code. I’m using WP_Query to loop through a custom post type called “Event.” I’m also limiting the posts to only those with a date newer than today, using a custom field. Finally, I’m using the WP Paginate plugin for pagination.

    I’m getting the correct number of posts to show up. However, the pagination plugin is showing a total of 5 pages, no matter how little or how many posts are being pulled in through the loop.

    Any help would be very appreciated.

    $today = date('Ymd');
    $args = array(
        'post_type' => 'event',
        'posts_per_page' => 5,
        'meta_key' => 'event_date',
        'meta_compare' => '>',
        'meta_value' => $today,
        'orderby' => 'event_date',
        'order' => 'ASC',
        'paged' => $paged
    $event_post = new WP_Query($args);
    if ( $event_post->have_posts() ) {
        // The loop
        while ( $event_post->have_posts() ) {
            // The Content
        // End of the loop
        if(function_exists('wp_paginate')) { wp_paginate(); }
    } else {
        // no posts found

  • The topic ‘Incorrect Number of Pages with Custom Post Type’ is closed to new replies.