I have a custom post type where I have a taxonomy cities
and a term berlin
. Archive can be seen at example.com/cities/berlin
and it's rendered normally from the archive.php
template.
Now, I want to order them according to a custom field, start_date
in this case, but still keep the original query around. So that when I navigate to example.com/cities/newyork
the loop would still work as expected.
This is what I have but I only get the <p>Not Found</p>
in the end.
Please help.
Thanks :)
<?php
global $query_string; //to keep the original query around
$args = array(
'orderby' => 'meta_value_num',
'meta_key' => 'start_date',
'order' => 'DESC'
);
$posts = query_posts($query_string . $args);
if (have_posts()) : while (have_posts()) : the_post();
?>
do stuff
<?php endwhile; else : ?>
<p>Not Found</p>
<?php endif; ?>