• My blog has category structure that consists of categories and child categories. I am using the Top Level Categories plugin to remove the base URL.

    What I would like to accomplish is put the category description at the very top of every category archive for SEO. This would be done outside the loop.

    I’m having trouble however isolating the exact category in which I am navigating. Using get_the_category() simply gives me the category of the first item in the query (even if in a parent cat archive, it gives me the cat name of the first child in that archive) and get_categories() just gives me all the categories.

    It’s important to note that for the purpose of my theme and the plugins I am using, articles with child categories do not have their parent category checked. So only, one category per article.

    Can anyone help with this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • put the category description at the very top of every category archive

    Look at the WordPress Default theme’s archive.php for an example of using single_cat_title()

    Also there is this to get the current category being queried:

    <?php
    if ( is_category() ) {
    $current_category = get_query_var('cat');
    }
    ?>

    Thread Starter Sebastien Couture

    (@scouture)

    Thanks, that just simplified a lot of things for me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get specific category name’ is closed to new replies.