I have a permalink structure of /%catergory%/%postname%/.
When I go to blah.com/categoryname I want all posts in that specific category to be listed. When I go to blah.com/categoryname/post-name I want just the specific post to be displayed.
I have made a category specific template (category-5.php) and have got as far as...
// Display all post titles in category loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php endwhile; ?>
<?php endif; ?>
// Display specific post in category loop
<?php if ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<div class="storycontent">
<?php the_content(); ?>
</div>
<?php endif; ?>
...but obviously I only want the first loop to display when the url is blah.com/categoryname, and the second loop to display when the url is blah.com/categoryname/post-name.
Any thoughts? thanks