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.

1 Answer 1


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); ?>
  • 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
    Commented Jun 17, 2011 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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