WordPress.org

Support

Support » How-To and Troubleshooting » Grab the Child Cat Name and Display It

Grab the Child Cat Name and Display It

  • 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.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Grab the Child Cat Name and Display It’ is closed to new replies.
Skip to toolbar