Well, natively, when a user clicks on a tag link presented via a Tag Cloud Widget, or a display the_tags with each of your posts, then WordPress will automatically list all the posts with that tag.
See Tag Templates, Template Hierarchy, the_tags(), and wp_tag_cloud().
But this could be used in a template such as a sidebar.php or page template:
<?php
$term = get_term_by('slug','important', 'post_tag');
$args=array(
'tag__in' => array($term->term_id),
'post_type' => 'post',
'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 'List of Posts in tag '. $term->description;
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
is there a way to limit to show only 5 on the list rather than every post under a specific tag?
Try using:
$args=array(
'tag__in' => array($term->term_id),
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 5,
'caller_get_posts'=> 1
);