Dukeo » WordPress » Highlight Current Category: Easy Code Snippet

Highlight Current Category: Easy Code Snippet

Steven 2 responses WordPress

Making your WordPress blog as user-friendly as possible should always be your goal.

Keeping usability in mind will allow you to improve your visitors’ experience. One of the steps you should take is keeping your visitors informed about the category they are browsing right now.

When you’re browsing a category on a WordPress blog, WordPress automatically adds a current-cat css class to the corresponding <li> element.

In order to make it more visible or your visitors, you need to edit the file style.css in your theme folder and add a custom style for the current-cat class:

.current-cat{
  font-weight:bold;
  background-color:#000;
  color:#fff;
  text-decoration:underline;
  font-style:italic;
}

Edit the style to fit your taste, and your readers will always know exactly what category they’re browsing right now.

If you enjoyed this article,
Get email updates

Join for Free »

2 Comments

  1. Irfan

    This could make sense; you got something new for us to read. Thanks!

  2. Rolf

    Thanks a lot! That was just what I was looking for.