Grab the Child Cat Name and Display It (3 posts)

  1. dave_merwin
    Posted 9 years ago #

    I would like to grab the name of a child category and display it. I want to do the grab based on the PARENTS cat id.

    For Example:

    if (in_category(2)) //"2" is the parrent category{
    foreach((get_the_category()) as $cat) {
    echo $cat->cat_name;

    This does not work though. Any ideas?

    Lemme know.

  2. theiconoclast31
    Posted 9 years ago #

    If this is within the loop, you might try using the wp_list_cats template tag:


    Scroll down to 'child_of'

  3. dave_merwin
    Posted 9 years ago #

    Good thought but that will not work. The wp_list_cats displays a list an dteh argument "child_of" simply displays a list of cats from a parent. Not quite what I had in mind. Thanks though.

    I think I am going to have to run a custom query.

Topic Closed

This topic has been closed to new replies.

About this Topic