-
AuthorPosts
-
September 16, 2016 at 7:46 am #687274
Hello Enfold Team,
I have a question concerning the main menu:
I would like to make the menu item active when clicking into a product.
(I have a general page in my Menu “Work Pants” I would like to keep “Work Pants” highlighted when I click on one of my products).I tried this CSS but it doesn’t work:
#avia-menu .active-parent-item { overflow: visible !important; }
and
.html_header_sidebar #header .av-main-nav .active-parent-item { overflow: visible !important; }Could you help me with that.
Thanks again for your help.
Kind regards
Bibahbuh
September 17, 2016 at 12:40 pm #687925Hey bibahbuh,
Could you post a link to the site in question so that we can take a closer look please?
Thanks,
RikardSeptember 18, 2016 at 3:08 am #688030Hey Rikard,
Thanks for your reply.
Please find the link to the website in the private data.Thanks.
Kind regards,
BibahbuhSeptember 18, 2016 at 8:37 am #688074Hi,
We added the below code to functions.php please review the site and let us know if you have any questions.
// highlight work menu function highlight_menu(){ ?> <script> jQuery(window).load(function(){ if (jQuery('body').hasClass('single-portfolio')) { jQuery('.main_menu').find('#menu-item-455').addClass('current-menu-item'); } }); </script> <?php } add_action('wp_footer', 'highlight_menu');
Best regards,
VinaySeptember 18, 2016 at 8:49 am #688080Hello Vinay,
Thanks a lot!! It’s working great!
Have a nice day.Kind regards.
BibahbuhSeptember 18, 2016 at 9:08 am #688082Hello again,
I have another question concerning the highlight menu:
If I want the same when I’m in another tab, like accessories page. Do I have to change something in the Theme Function.php?And also, is it possible to have in my accessories product with this url: /accessories/henning/ instead of /work-pants/henning/
(I changed it via Settings/permalink/Portfolio Items Base –> Work Pants)But as you can see in my website I have two tab: work pants and accessories. (I distributed my portfolio items into 2 tabs: Work Pants and Accessories)
Thanks a lot again for your help.
Kind regards.
BibahbuhSeptember 18, 2016 at 1:34 pm #688109Hi,
You are welcome :) WordPress adds a class called “single-portfolio” to the bod tag which we can use in jQuery to check if body tag has a class that we want and highlight the work pants menu.
If you add a portfolio item in accessories that will also highlight work pants because wordpress will always only add “single-portfolio” to body tag and it cannot be differentiated hence can be used only on one menu item.
To change the permalinks please check https://codex.wordpress.org/Settings_Permalinks_Screen
Best regards,
Vinay- This reply was modified 8 years, 3 months ago by Vinay.
September 19, 2016 at 6:58 am #688304Hello Vinay,
Thanks for your reply :)
What I did and works great:I add a wordpress plugin: Custom Permalinks.
With this plugin I was able to change my portfolio items url: /work-pants/henning by /accessories/henning (because this item “henning” is located in an other page call Accessories and not Work Pants)Then, I add a wordpress plugin : Yoast SEO for the 301 redirection to an old to a new url (if I understood well) by modifying the .htaccess file.
Everything is working great, for now. (the website is not yet live.)
Hope I did well.Thanks again.
Kind regards.
BibahbuhSeptember 20, 2016 at 6:37 am #688947Hi,
Great, glad you got it working and thanks for the feedback :-)
Please let us know if you should need any further help on the topic.
Regards,
RikardSeptember 20, 2016 at 12:11 pm #689095Hi Rikard,
Thanks for your reply.
All good for me now :)Thanks for your help, great support!
Kind regards.
BibahbuhSeptember 20, 2016 at 9:20 pm #689537Hi,
Glad we could help! We really appreciate it if you rate our theme on themeforest.
To know more about enfold features please check – http://kriesi.at/documentation/enfold/
Please feel free to reach out to us if you need any help in future via new ticket we are happy to help!
Thank you for using Enfold :)Best regards,
Vinay -
AuthorPosts
- The topic ‘How to keep a main menu tab highlighted when I click on a product item?’ is closed to new replies.