Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1066394

    Dear support,
    the following page is marked as a “mainpage” so the title “Publikationen” should be marked red in the main-menu when this page is selected. But if selected also the first main-menu “Die ZSG” is marked red s well. Do you know why? Maybe there is a fault in my custom.css?

    #1067031

    Hey dondela,

    Is the “Publikationen” the child page of “Die ZSG”?

    Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?

    Best regards,
    Victoria

    #1067047

    Dear Victoria,
    no “Publikationen” is not the child page of “Die ZSG”?.
    Please see the login-details below. Thanks for your help!

    #1068757

    Hi,
    Sorry for the late reply, I was not able to login, but examining your page shows that “Publikationen” is the child of “Die ZSG” because “Die ZSG” has these classes:
    “current-menu-ancestor current-menu-parent”
    If you hover over “Die ZSG” you will see “Publikationen” under it in the sub-menu, along with “e-Statistik” & “ZVEI-Akademie”.
    You could change how these menu items are related to each other, but I assume this would not be what you want to do.
    So the other option is to remove the parent menu item class when on the child page so the parent is not highlighted, Try adding this code to the end of your functions.php file in Appearance > Editor:

    function remove_parent_menu_highlighting(){
      ?>
      <script>
    (function ($) { 
      $(window).load(function() {
           if ($("body").hasClass("page-id-456")) {    
              $("#menu-item-28165").removeClass('current-menu-item');
          } 
           else if ($("body").hasClass("page-id-9416")) {
             $("#menu-item-28165").removeClass('current-menu-item');
          }
           else if ($("body").hasClass("page-id-9218")) {
             $("#menu-item-28165").removeClass('current-menu-item');
          } 
           else {
        }
      });
      })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'remove_parent_menu_highlighting');

    Best regards,
    Mike

    #1068858

    Dear Mike,
    awesome! This is it, now it works as expected!
    How can i remove another page from this class, for example “Die ZVEI-Akademie”?
    Thank you so much, great support!

    #1068937

    Hi dondela,

    https://cl.ly/2cf6021a99c4 It seems to be highlighted right here, which one do you want to be not highlighted?

    Best regards,
    Victoria

    #1068946

    Dear Victoria,
    i want just highlighted the main menu “ZVEI-Akademie”. But you are right, it is strange: When i click the link directly it is right highlighted when i reload the page both main menu items are highlighted again…(“Die ZSG”)

    #1069247

    Hi,
    The script above was to remove the Die ZSG highlighting when on the pages ZVEI-Akademie, Publikationen, & e-Statistik
    When reloading the page it might take a second for the script to fix the menu.
    I took another look and it’s working for me when clicking or reloading the page, but I do note that your page loads a little slow so there is a flash of red on Die ZSG.
    You may not experience this if you use a caching plugin to load the site quicker, I assume that you are not right now.

    Best regards,
    Mike

    #1069364

    Thanks for your help, awesome support!

    #1069561

    Hi dondela,

    Thanks for your kind words and glad that we could help :)
    Thanks for using Enfold and have a great day!

    Best regards,
    Nikko

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Menu submenu active state’ is closed to new replies.