Orderby => meta_value Not Working
-
I have a query, and am trying to sort via a custom field but it’s not working. It doesn’t change / sort anything at all.
Replacing this with orderby => title works fine, so I know it’s not a sorting issue elsewhere in the code…
Here’s a complete summary of my code, I’m really stumped and hoping someone might have a word of advice. I’m using the “Types” plugin, hence the reference to “types_render_field…”
Thanks so much in Advance!<?php // Set arguments for the query in a php array. $args = array( 'posts_per_page' => 100, 'post_type' => 'workshop-date', 'meta_key' => types_render_field("date", array("output"=>"raw")), 'orderby' => 'meta_value', 'order' => 'ASC'); $query = new wp_query( $args ); //While you still have posts (haven't displayed the last one) - then display it! if ( $query -> have_posts() ) : while ( $query -> have_posts() ) : $query -> the_post(); ?> //HTML Output of posts here <?php endwhile; else: ?> <p>There are no dates to display.</p> <?php endif; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Orderby => meta_value Not Working’ is closed to new replies.