-
AuthorPosts
-
February 13, 2019 at 11:00 am #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?February 14, 2019 at 4:30 pm #1067031Hey 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,
VictoriaFebruary 14, 2019 at 4:50 pm #1067047Dear Victoria,
no “Publikationen” is not the child page of “Die ZSG”?.
Please see the login-details below. Thanks for your help!February 19, 2019 at 5:13 am #1068757Hi,
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,
MikeFebruary 19, 2019 at 10:16 am #1068858Dear 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!February 19, 2019 at 1:20 pm #1068937Hi dondela,
https://cl.ly/2cf6021a99c4 It seems to be highlighted right here, which one do you want to be not highlighted?
Best regards,
VictoriaFebruary 19, 2019 at 1:32 pm #1068946Dear 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”)February 20, 2019 at 3:38 am #1069247Hi,
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,
MikeFebruary 20, 2019 at 10:19 am #1069364Thanks for your help, awesome support!
February 20, 2019 at 5:33 pm #1069561Hi dondela,
Thanks for your kind words and glad that we could help :)
Thanks for using Enfold and have a great day!Best regards,
Nikko -
AuthorPosts
- The topic ‘Menu submenu active state’ is closed to new replies.