custom taxonomy query – again…
-
I’m using a variation of Michael H’s great code to produce a list of wines organized by region:
<?php $args=array( 'region' => 'loire-valley', 'post_type' => 'producers', 'post_status' => 'publish', 'posts_per_page' => -1, 'caller_get_posts'=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { echo 'Loire Valley'; while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php query_posts($query_string . '&orderby=name&order=ASC'); ?> <?php get_template_part( 'content-archive' ); ?> <?php endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). ?>
But I have five regions (Loire Valley, Southwest, Burgundy, Rhone Valley, Champagne). Is there any way to automate the above so I don’t have to copy and paste it five times with each region listed?
In other words how can I make the $args variable cycle through all five regions and list their respective post types, in the manner above?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘custom taxonomy query – again…’ is closed to new replies.