2

I'm customizing a WordPress theme for my school, and I'm a bit annoyed by the fact that the current page in the nav menu is not indicated.

For example:

enter image description here

You can clearly see that I'm hovering over a page in the nav menu, and that the page I'm hovering over is highlighted, as expected.

However, the page that I'm currently on, called "Arhiva", is not highlighted, and I think that this can be somewhat confusing.

I don't want the current page and the page the mouse is hovering over to be highlighed in the same manner though. I believe that a bold entry text in the nav menu would do just fine to separate the current page from other pages.

How can I achieve this?

Theme's current CSS can be viewed here: http://petagimnazija.hr/wp/wp-content/themes/chiron/style.css.

4
  • Does it not work at all or for specific page(s)? Meaning is it broken or not implemented in first place in your theme?
    – Rarst
    Commented May 4, 2013 at 20:04
  • I'm pretty sure it's not implemented in the theme. But it should be trivial if WordPress provides the appropriate classes to me, right? (Please don't tell me it doesn't.)
    – jcora
    Commented May 4, 2013 at 20:17
  • Well, had you looked for them?.. :) Your site seems to be using custom menus and they seem to have appropriate classes like current-menu-item fine...
    – Rarst
    Commented May 4, 2013 at 20:25
  • That's what I was looking for, thanks @Rarst. If you'd put that in an answer, I'd be glad to accept it. I just forgot to look for those classes... SE makes you dumber in some cases :/
    – jcora
    Commented May 4, 2013 at 20:42

1 Answer 1

4

The Navigation Menus system is adding a lot of classes, including matching current page (rather intelligently, it will even try to detect custom URLs, that were input explicitly).

The simplest class to make use of is current-menu-item, but there are quite a few more dealing with parents/ancestors and more.

Codex has them documented at wp_nav_menu() > Menu Item CSS Classes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.