I made a tag.php under my theme folder in order to style all of the tagged post pages from urls like 'www.mywebsite.com/tag/kittens'.
However, if I go to 'www.mywebsite.com/tag/kittens' it displays all of my posts, even the ones that are not tagged 'kittens' or at all. I used the the standard loop, and I can't find a way to alter it to grab the tag page name and only return those posts without making a separate 'tag-kittens.php' type page for every single tag.
Help?
<?php
get_header();
query_posts( 'posts_per_page=5' ); ?>
<?php the_tags( $before, $sep, $after ); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="post">
<!-- Display the Title as a link to the Post's permalink. -->
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. -->
<small><?php the_time('F jS, Y') ?></small>
<div class="entry">
<?php the_content(); ?>
</div>
</div> <!-- closes the first div box -->
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif;
get_footer();
?>
query_posts()
, overwriting the main query. Remove that, and your template will work.