Hope somebody can help. I have a custom post type called “dinner-dates”, which has a custom field called “show-date” which displays the dates of dinner-date events.
The custom post type has a custom taxonomy called “Show-Name” which outputs various shows by show name IE: “Fawlty Towers” etc.
When I click a particular show name on my nav menu, it displays a grid of all upcoming events called “Fawlty Towers” and displays them.
What I would like to do now is order these events by there show date. So order by meta-value-num ASC.
How do I do this on a taxonomy page? At the moment it is using the standard..
while have posts loop.
When I tried doing a custom query the output on the taxonomy template page is to display ALL show events in the correct order. However I only want to display the Fawlty Towers ones not every possible Show.
Hope that makes sense.
I am guessing you have to order it by whatever the current taxonomy term is, but I am not sure how I go about grabbing the info in this way and ordering it correctly.
I will put the code in below, hopefully somebody can help…
Thanks Dan
<ul class="events-listing-index">
<?php: while (have_posts()) : the_post(); ?>
<li>
//This is where the info about the show is, thumbnail, link to book tickets, more info about the show, the show date, venue and location.
</li>
<?php endwhile; ?>
</ul>
This is the code I run when I am on other pages throughout the site in order to order the posts by custom field.
$args = array(
'post_type' => 'cdc-dinner-dates',
'posts_per_page' => -1,
'meta_key' => 'wpcf-rtd-show-date',
'orderby' => 'meta_value_num',
'order' => 'ASC'
);
$query = new WP_Query( $args );
?>
This is how I want to order the posts, but on a taxonomy.php page.