On a page for my record label I have 2 loops on the one page, displaying a custom post type called ‘releases’.
I’m using the advanced custom fields plugin, and depending on whether a record has a value of out now, or coming soon depends which of the loops it will display in.
Both loops start like this:
<?php // args $args = array( 'numberposts' => -1, 'post_type' => 'releases', 'meta_key' => 'whether-release', 'meta_value' => 'outnow' ); $the_query = new WP_Query( $args ); ?> <?php query_posts($query_string . "&order=ASC", 'post_type=releases'); ?> <?php if( $the_query->have_posts() ): ?> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
The first loop works correctly, however in the second loop on the page, it is displaying in the standard most recent back to oldest order (thus ignoring the &order=ASC )
I am still learning PHP so if there is a more efficient way to do this that would also be welcome.
- The topic ‘Reverse post order with 2 loops on a page’ is closed to new replies.