I have a custom tag-like taxonomy called PEOPLE registered to all post types - both the default and custom ones.
I have created a template for a single term named taxonomy-people.php and I'm intending to use it to describe a specific term and query each post type for instances of that term.
I have almost managed to do that, there's a single issue left: I don't know how to get WP_Query to show only results for the current term WITHOUT having to make a specific template for each of the terms, as I will end up having a three-digit number of terms under PEOPLE.
Here's the code that works if I specify a term. What should I replace 'people' => 'dave-lee' with in order to use the same template for each of the terms under PEOPLE?
<?php get_header(); ?>
<div class="eight columns" id="content">
<div class="post">
<div class="inside">
<p class="term-description">
<?php $termDescription = term_description( '', get_query_var( 'taxonomy' ) ); if($termDescription != '') : ?> <?php echo $termDescription; ?> <?php endif; ?>
</p>
<h3>News mentioning <?php $term = $wp_query->queried_object; echo ''.$term->name.'';?></h3>
<ul>
<?php $loop = new WP_Query( array( 'post_type' => 'post', 'people' => 'dave-lee', 'posts_per_page' => 20 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li class="archivepostlink"><a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a><br />
<?php _e('Published on','jf'); ?> <?php the_time(get_option('date_format')); ?></li>
<?php endwhile; ?>
</ul>
<?php wp_reset_query(); ?>
<h3>Releases <?php $term = $wp_query->queried_object; echo ''.$term->name.'';?> contributed to:</h3>
<ul>
<?php $loop = new WP_Query( array( 'post_type' => 'release', 'people' => 'dave-lee', 'posts_per_page' => 20 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li class="archivepostlink"><a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a><br />
<?php _e('Published on','jf'); ?> <?php the_time(get_option('date_format')); ?></li>
<?php endwhile;?>
</ul>
<?php wp_reset_query(); ?>
<h3>Songs featuring <?php $term = $wp_query->queried_object; echo ''.$term->name.'';?>:</h3>
<ul>
<?php $loop = new WP_Query( array( 'post_type' => 'song', 'people' => 'dave-lee', 'posts_per_page' => 20 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li class="archivepostlink"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
<?php _e('Published on','jf'); ?> <?php the_time(get_option('date_format')); ?></li>
<?php endwhile;?>
</ul>
<?php wp_reset_query(); ?>
<h3>Articles, reviews and other pages mentioning <?php $term = $wp_query->queried_object; echo ''.$term->name.'';?>:</h3>
<ul>
<?php $loop = new WP_Query( array( 'post_type' => 'page', 'people' => 'dave-lee', 'posts_per_page' => 20 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li class="archivepostlink"><a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a><br />
<?php _e('Published on','jf'); ?> <?php the_time(get_option('date_format')); ?></li>
<?php endwhile;?>
</ul>
<?php wp_reset_query(); ?>
<p>If you think <?php $term = $wp_query->queried_object; echo ''.$term->name.'';?> was/were a part of something else that has not been listed here, drop a line.</p>
</div>
</div>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
Thank you.