Support » Fixing WordPress » How make category show as “current” in e.g. header or menu?

  • Resolved danvendel



    I have tested a number of different blogware the past weeks, so I might recollect wrong. But I remember that when a user spcifically selects a certain category in the side menu, the name of this category shows up in the header where the blog name is otherwise, and the blog name itself moves to where the blog description is normally.

    But it’s not working. In fact, there’s no way a user can say which category he’s in unless he’s keeping perfect track of his clicks. No “current” link highlighted in the sidebar menu, no headline, no header – nothing.

    So, how can I make this obvious to the user? I’m open for any suggestion (I know a bit php and can fiddle with code if that’s what it takes).

    I use version 2.3.2 and theme called “Chopati”.


Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    This is hard to answer without more specific details.

    However, most of the functions in WordPress, like wp_list_categories(), provide a CSS indicator of the current category (or whatever) when appropriate.

    If you use wp_list_categories to display a category listing, then when you’re on the category archive page, you’ll find that the current category being displayed automatically gets an extra CSS class of “current-cat”. By styling .current-cat in your CSS, you can provide a visual indicator of what the current category is.

    There’s similar indicators for wp_list_pages() and other such functions. But exactly how to make it work for a particular site depends on the site. We’d have to see the site in action, see some of the code being used to display the category list, etc.

    Thanks Otto,

    I’ll look into your suggestion and see what I can do. Will get back to you.



    Yes, I edited the stylesheet as you suggested. But not just the plain class “current-cat” but with its selector “a”, i.e. I had to create class “.current-cat a”.

    This was better than before. Still, if anyone reads this, I’m still looking for a way to add the current category as a headline. I’m right now looking into the plugin “WP-Sticky 1.10” and see if I can make that work the way I want it.


    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    dan: The single_cat_title() function will output the current category when looking at a category archive page.

    Thanks Otto.

    <?php echo “<div id=\”catTitleHeader\”>”;
    single_cat_title() ;
    echo “</div>”; ?>
    to the themes index.php, made a style #catTitleHeader and it works perfectly!


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How make category show as “current” in e.g. header or menu?’ is closed to new replies.