How to link to a category? (2 posts)

  1. jessn
    Posted 6 years ago #

    Hi guys! I've spent the better part of a week trying to figure out how to do this and I'm just stuck. I'm trying to display a list of categories, the children of parent category '5', along with their recent posts. However I want the category titles and the recent posts to link to the category page which will pull up all posts filed under that category. And I can't figure out how to do it!

    What do I need to put inside the a href="..." to find the name of the current category that's being looped through and place that name inside? MANY THANKS FOR ANY HELP!!

    <?php $categories = get_categories("child_of=5"); foreach ($categories as $cat) { ?>
    <?php query_posts("cat=$cat->cat_ID&showposts=10&order=ASC&orderby=name"); ?>
    		<h2><?php single_cat_title(); ?></h2>
    		<?php while (have_posts()) : the_post(); ?>
    		<a href="linktothespecificcategory"><img src="image"></a>
    		<?php endwhile; ?>
    <?php }?>
  2. Shane G
    Posted 6 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic