[Resolved] How make category show as “current” in e.g. header or menu?
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”.
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-catin 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.
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.
dan: The single_cat_title() function will output the current category when looking at a category archive page.
- The topic ‘[Resolved] How make category show as “current” in e.g. header or menu?’ is closed to new replies.