Support » Fixing WordPress » current-menu-item & AJAX

  • hi,

    i need to highlight my active menu item, i know that the latest method to do so is the current-menu-item class.

    but as i am loading my content via ajax for some reasons, the menu is always on the same page (home).

    does anybody knows the trick to highlight the menu link?

    this ist the page: (work in progress ;))

Viewing 4 replies - 1 through 4 (of 4 total)
  • wpismypuppet


    If you are using ajax to load content onto the page, then use jQuery to add/remove the current-menu-item class from the menu item in question. Something like jQuery(‘#menu-item-8’).addClass(‘current-menu-item’). Don’t forget to use .removeClass() to take it off the “old” link…

    ok, cool.

    i ended up doing this:

    $(function() {
        $('#nav ul li a').click(function() {
            $('#nav ul li a').each(function() {

    and then just style my .selected class in css

    Clementine Kruczynski


    I’m new on jquery and ajax and I’ve been trying to solve this in different ways for three hours and I was getting desperate, it was so simple….. thanks so much!!!

    how do I exactly paste the above mentioned code in the header area of the header.php ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘current-menu-item & AJAX’ is closed to new replies.