The code you’ve provided doesn’t actually print out the list of pages; it just creates the query for them. Assuming you have additional code for displaying them, the easiest way to accomplish what you want in a plugin is to build that list, then add them using the_content
filter. I would probably create the list of pages in one function, the add those pages to the_content
with a second function added to the filter. Here’s something that should help to get your started:
function my_posts_list() {
global $post;
query_posts( array (
'post_type' => 'page',
'posts_per_page' => -1,
'my_taxonomy' => $post->post_title
));
// Build your HTML list of posts from the query.
}
function filter_the_content($content) {
// Only filter the content if we're on a single 'my_post_type' page.
if (is_singular('my_post_type')) {
$postsList = my_posts_list();
$content = $postsList . $content;
}
return $content;
}
add_filter('the_content', 'filter_the_content');
There are, of course, plenty of additional things you could do with this, like check if there the list of posts isn’t empty.