• Hi,

    My wordpress site was recently moved to a new server, and one of the issues that cropped up was, all menu items are attributed the “current-menu-item” class.

    This only occurs on the homepage, where no menu items should have the current style.

    I have spoken to our system administrator and assures me, nothing has changed.

    I’m running the latest version of wordpress, using UberMenu and a host of other plugins. I have tried deactivating, and activating, and even deleting all other plugins and trying again.

    When the links are removed on the menu items then the problem disappears, but it’s a useless fix as we obviously need the links.

    This is some code I modifyed, which we used to use to change the “current” class to active, but I’ve just removed the active, so nothing is printed, I was hoping with an if statement around it, it would work only for the home page, but that doesn’t seem to be the case.

    if(is_home) {
        function current_to_active($text){
        $replace = array(
        //List of menu item classes that should be changed to "active"
             'current_page_item' => '',
             'current_page_parent' => '',
             'current_page_ancestor' => '',
        );
        $text = str_replace(array_keys($replace), $replace, $text);
        return $text;
        }
        add_filter ('wp_nav_menu','current_to_active');
    }

    If anyone has any ideas, I would appreciate the help, as I am completely stuck.

    Thanks in advance!

    John

Viewing 4 replies - 1 through 4 (of 4 total)
  • Does your theme use a static page for the homepage?

    Thread Starter johnpanz

    (@johnpanz)

    I use home.php for my home page, with a few WP_queries on it.

    Within my site, I use 5 different custom post types, and pages to form the basic structure of the site.

    Below is a link to our old test site, which works fine, but I’m using it so you can see the structure of the site.
    Test Website

    The top menu items, Machine Tools, Automation, etc… link to pages.

    Thread Starter johnpanz

    (@johnpanz)

    So, nobody has any idea in regards to this issue? I still can’t figure it out?

    Please, per forum rules, link us to your live site for CSS support (which is your issue). If we cannot see the live site’s CSS in action, it is quite unlikely any forum member (here or elsewhere) can be of much assistance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘All menu items are "current" on home page???’ is closed to new replies.