WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried using wp_list_categories, but that just gives me a list of the categories. I currently have this code in my category-recipes.php file:

<ul class="subcats-list">
            <h2 class="subcats-title"><?php echo get_cat_name(38); ?></h2>
                $recipes = new WP_Query();

                while ($recipes->have_posts()) : $recipes->the_post(); ?>
                    <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
                <?php endwhile; ?>

        </ul><!-- subcat -->

I was thinking about putting a link tag before the get_cat_name but I am not sure what to include in it.

share|improve this question
up vote 1 down vote accepted

Use get_category_link. Your code (relevant part) will look like:

<h2 class="subcats-title">
    <a href="<?php echo get_category_link(38); ?>">
        <?php echo get_cat_name(38); ?>
share|improve this answer
Thanks. Worked. I had that but did not include the echo before get_category_link which resulted in staying on the same parent category page... – chris_s Jun 17 '11 at 17:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.