Greetings all,
When someone clicks in a category link, I would like to display all post titles and only that in a unordered list format.
It's pretty much like the archive works, but instead of getting all posts of all categories in one page, you only get the ones that belong to that particular category.
Example:
Let's assume I click on the 'Games' category sidebar link, which sends me to http://www.myblog.com/category/games.
So it gets something like this:
**************************************
Games
**************************************
Hope you can help me out. Thanks.
jamesspratt
Member
Posted 2 years ago #
Hey,
Did you ever work this out, I'm after the same thing.
Thanks,
James
jamesspratt
Member
Posted 2 years ago #
Right.
You need to create a whole new php sheet: category.php
then include amongst your other stuff this:
<div class="post" id="post-<?php the_ID(); ?>">
<h4><?php single_cat_title('Full category post listings for: '); ?></h4>
<ul>
<?php while(have_posts()) : the_post(); ?>
<?php foreach((get_the_category()) as $category)
{ $my_query = new WP_Query('category_name=' . $category->category_nicename . '&orderby=date&order=des&showposts=100');} ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> • <?php the_time(' jS F Y'); ?></li>
<?php endwhile; ?>
<?php break; endwhile; ?>
</ul>
Outside of the loop, i.e. take out the normal loop references.