WordPress.org

Support

Support » How-To and Troubleshooting » using category for title in single.php

using category for title in single.php

  • I would like to add my category title to single.php, as the headline for the page. However, I only want to include the child category, not the parent AND child category. And, I’d like the headline to be a link to the category page.

    In essence, is there a way to display something like what you get for single_cat_title(); (in archive.php), but in single.php? When I put the single_cat_title(); code into single.php, it doesn’t display anything; when I put the_catgory(); into single.php, it lists the parent and child categories, which is too much.

    I could write a bunch of if ... else statements, one per category, but gosh that seems like a pain in the behind.

    Thanks very much for any help!

  • The topic ‘using category for title in single.php’ is closed to new replies.
Skip to toolbar