WordPress.org

Ready to get started?Download WordPress

Forums

All menu items are "current" on home page??? (5 posts)

  1. johnpanz
    Member
    Posted 9 months ago #

    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

  2. BeardedGinger
    Member
    Posted 9 months ago #

    Does your theme use a static page for the homepage?

  3. johnpanz
    Member
    Posted 9 months ago #

    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.

  4. johnpanz
    Member
    Posted 8 months ago #

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

  5. Pioneer Valley Web Design
    Member
    Posted 8 months ago #

    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.

Reply

You must log in to post.

About this Topic