[LOOP] Trouble w/ orderby metakey values
-
Okay I’ve created the following loop in order to sort my posts from Category 2 by the user-entered date field ‘prana_event_date’ and display only the 5 next posts. I’m not totally sure I set this up properly as it’s not changing when I switch from ASC to DESC. Can an of you experts shine some light on my noobishness.
<!-- LOOP START --> <?php //WP_Query Arguments $args = array ( 'cat' => '2', 'posts_per_page' => '5', 'meta_key' => 'prana_event_date', 'orderby' => 'meta_value_num', 'order' => 'ASC', ); ?> <?php $the_query = new WP_Query( $args ); ?> <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?> <section><a href="<?php the_permalink() ?>"><?php the_post_thumbnail( array(175,110) );?><div class="overlay"></div></a><div class="event-info"><h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3><p class="date"><?php the_field( 'prana_event_date' ); ?></p><?php the_excerpt(); ?><a href="<?php the_permalink() ?>" class="more-info">more info ></a></div></section> <?php endwhile;?> <!-- LOOP FINISH -->
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘[LOOP] Trouble w/ orderby metakey values’ is closed to new replies.