Order by custom field date
-
Hi!
I’m trying to display a list with all the posts of a post type called ‘agenda_item’, in descending order. The hard part is that they need to be ordered by a date which is stored in a custom field called ‘agenda-datum’. And the format of this date is dd-mm-yyyy. I can’t wrap my head around this, maybe you guys can help me out, thanks!
This is what I got so far:
<?php query_posts( array ( 'post_type' => 'agenda_item', 'meta_key' => 'agenda-datum', 'orderby' => 'meta_value', 'order' => 'DESC' ) ); while ( have_posts() ) : the_post(); //more_fields(); Echoes the value of a given custom field key more_fields("agenda-datum"); endwhile; wp_reset_query(); ?>
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Order by custom field date’ is closed to new replies.