Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
3  
taxonomy is depreciated, you should switch to tax_query. Also, I do not believe term is an actual parameter. –  m0r7if3r 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 Answer 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 
);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.