WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Pagination Not Working - WP_Query with &Paged= (2 posts)

  1. brianfeister
    Member
    Posted 3 years ago #

    I've got a custom WP_Query being called as an array and I'm not sure how to call "&paged=" when it is contained in an array.

    Normally it would be:

    wp_query->query('showposts=10'.'&paged='.$paged .'cat=classes')

    But for some reason the same code when presented as an array is not working:

    <?php
                    $current_date = date('ymd');
                    $recentEvents = new WP_Query();
                    $recentEvents->query(array(
                        'category_name' => 'classes',
                        'meta_key' => '_date_compare',
                        'meta_compare' => '>=',
                        'meta_value' => $current_date,
                        'orderby' => 'meta_value',
                        'order' => 'ASC',
    					'showposts' => 10,
    					'&paged' => $paged
                    ));
                    if ($recentEvents->have_posts()) : while ($recentEvents->have_posts()) : $recentEvents->the_post(); ?>
  2. brianfeister
    Member
    Posted 3 years ago #

    This is the answer to my question, scrolling down, the original poster solves his own problem and that was my problem as well "custom_query_name" instead of "wp_query":

    http://wordpress.org/support/topic/wp_query-amp-pagination-not-working?replies=11

Topic Closed

This topic has been closed to new replies.

About this Topic