Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax

You are looping through all states and running a query on each iteration, but the query you are doing is nothing to do with the loop. You are checking for $_GET[‘state’], which would be the state passed over the query string. <?php foreach ( $states as $state ) { $state_query = new WP_Query( array( ‘post_type’ … Read more

add_query_arg to look up page title

It depends a bit on what are your exact status slug and title and page title are, but something like this should work, if I understand you correctly: $page = get_page_by_title($status->name.” tickets”); echo ‘<li><a href=”‘.get_permalink($page->ID).'”>’ .$status->name.’ (<span>’.$counts[$status->slug].'</span>)</a></li>’;

Transfer taxonomy to custom field

You can order posts by custom taxonomy terms by adding a posts_clauses filter, see below answer: https://wordpress.stackexchange.com/a/14313/14499 Make sure that on functions.php you add both that function AND the call to add_filter(‘posts_clauses’, ‘orderby_tax_clauses’, 10, 2 );, otherwise it won’t work. Assuming annee is the custom taxonomy, this should then work: query_posts($query_string . ‘&posts_per_page=-1&orderby=annee&order=ASC’);