If the code for the ‘actual template’ you posted is in the single-people.php
…
you do not need any query at all!
When you call the url mysite.com/people/firstname-lastname
wordpress already know that you want to view that person, only search for a file that display it.
Normally, wordpress, in this case, search for the file single-people.php in the theme folder and if don’t find it, than search for single.php
and so on, following Template Hierarchy.
Your plugin modify this behavior, so if no single-people.php
file is the theme folder, instead of searching for single.php
in theme now wordpress search for single-people.php
in your plugin folder.
So, again, if the file come from single-people.php
you have not to put here any query at all to use the standard main wp query that is, in this case, just showing the post.
<?php get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php if ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="person">
<div class="person-header">
<div class="person-image">
<?php the_post_thumbnail( array( 300, 300 ) ); ?>
</div>
<div class="person-name"><?php the_title(); ?></div>
<div class="roles-list">
<?php echo get_the_term_list( get_the_ID(), 'roles', '', ', ', '' ); ?>
</div>
</div>
<div class="person-content"><?php the_content(); ?></div>
</div>
</article>
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>
1
solved Template for custom post type shows all posts instead of just one