0

I have a custom loop:

$args = array(
    'post_type' => 'symposia_program',
    'taxonomy' => 'days', 
    'term' => 'day-1',
    'order' => 'ASC'
);

$query = new WP_Query($args);
if ( $query->have_posts() ) :
    while ( $query->have_posts() ) :
        $query->the_post();
        .....(code)....
    endwhile; 
endif;
wp_reset_query();

For some reason, the 'order' => 'ASC' parameter has strange effects on the output of the loop. Basically it doesn't render some of the posts, namely some recent ones. If I switch back to DESC, all the posts show up. Please help!

  • 3
    taxonomy is depreciated, you should switch to tax_query. Also, I do not believe term is an actual parameter. – mor7ifer May 4 '12 at 21:29
  • Thanks. That didn't seem to be the problem though. It seems the problem is solved by adding 'posts_per_page' => -1 which forces wordpress to show all posts matching the parameters. Here's my final code:'post_type' => 'symposia_program', 'days' => $progDay, 'meta_key' => 'class_number', 'orderby' => 'meta_value_num', 'order' => 'ASC', 'posts_per_page'=> -1 ); – Roman Epicnerd Sharf May 5 '12 at 6:06
1

It seems the problem is solved by adding 'posts_per_page' => -1 which forces WordPress to show all posts matching the parameters. Here's my final code:

array ( 
    'post_type'      => 'symposia_program', 
    'days'           => $progDay, 
    'meta_key'       => 'class_number', 
    'orderby'        => 'meta_value_num', 
    'order'          => 'ASC', 
    'posts_per_page' => -1 
);

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.