-
AuthorPosts
-
November 8, 2016 at 6:11 pm #709916
Hi,
i’m desperately trying to keep the current page highlighted on the main menu when I go into an individual woocommerce product page. So for example, on the following page I want the “OWN” in the main menu to be highlighted…
Any help would be greatly appreciated!
Cheers,
ThomasNovember 10, 2016 at 9:06 am #710581Hey thomashutton,
Try to add this code in Quick CSS (located in Enfold > General Styling):
.menu-item-mega-parent > a .avia-menu-text { color: yellow; }
Just change the color value as you see fit. Hope this helps :)
Best regards,
NikkoNovember 12, 2016 at 7:54 pm #711481Thanks Nikko, that seems to work for the “Own” menu heading but when i’m on of the “Rent” product pages, or “Used” pages “Own” is still highlighted rather than “Rent” or “Own” respectively?
November 14, 2016 at 4:40 pm #712058Hi,
Please remove the code Nikko posted above and post us your login credentials (in the “private data” field), so we can take a look at your backend.
Login credentials include:
- The URL to the login screen.
- A valid username (with full administration capabilities).
- As well as a password for that username.
- permission to deactivate plugins if necessary.
Best regards,
YigitNovember 16, 2016 at 2:48 am #712697Thanks Yigit, please find the details in the private content area… Big thank you… Thomas
November 17, 2016 at 8:13 am #713428Hi,
Did you use “own”, “rent” and “used” as category of those products? If you did, you can add this in the functions.php file.
add_filter( 'body_class', function( $classes ) { global $product; $terms = wp_get_post_terms( $product->id, 'product_cat', array( 'fields' => 'slugs' ) ); switch (true) { case in_array( 'own', $terms ): $classes = array_merge( $classes, array( 'own' ) ); break; case in_array( 'rent', $terms ): $classes = array_merge( $classes, array( 'rent' ) ); break; case in_array( 'used', $terms ): $classes = array_merge( $classes, array( 'used' ) ); break; default: $classes = $classes; } return $classes; });
And then use this css codes.
.own #menu-item-735 > a .avia-menu-text { color: green; } .rent #menu-item-40 > a .avia-menu-text { color: red; } .used #menu-item-69 > a .avia-menu-text { color: blue; }
Best regards,
IsmaelNovember 18, 2016 at 10:45 pm #714203Thanks for this Ismael, yes the stores on those pages are organised according to the categories.
The PHP code doesn’t seem to be working though… the first and last line are showing as having errors, do I need to bracket them in some other code?
November 19, 2016 at 5:04 am #714235Hi,
We added the code in the functions.php file and it’s not causing any errors. However, the code is not working in your installation. Please post the ftp details here so that we can inspect it further.
Best regards,
IsmaelNovember 25, 2016 at 4:27 pm #716922Hi,
weirdly I added the ftp details in a private message a while ago but just checking now it doesn’t seem to have gone through?! Here it is again…
Thanks, Thomas
November 29, 2016 at 6:09 am #718108Hi,
Thank you for the info. We modified the code in the functions.php file. Please remove browser cache or hard refresh before checking the page product page.
// http://weflexcarsales.com/own-cat/new-toyota-prius-active/
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.