WordPress.org

Support

Support » Themes and Templates » How to display Category Name and conditionally Category Parent Name in Archive

How to display Category Name and conditionally Category Parent Name in Archive

  • Hey all —

    archive.php categories.

    Two types of category archives:

    Child categories including one parent — should display the parent and child category. This works well with get_the_category()

    Parent categories including multiple children categories — should display only the Parent category name. I can’t figure out how to use get_the_category() because it pulls a child/parent category combination from the posts and I can’t test to see if the archive page is a top level category.

    A function for the archive page which tests to see if it is a parent category would work. Any ideas? Thank you!

  • The topic ‘How to display Category Name and conditionally Category Parent Name in Archive’ is closed to new replies.
Skip to toolbar