-
AuthorPosts
-
November 29, 2016 at 6:46 am #718121
I’m trying to add class directly on the menu link, not the outer elements covering the link.
But directly on it or else the wistia popup class won’t work.
Here’s the setup:
Home | Product Tour } PricingWhen someone clicks product tour, a wistia video pops up. But class needs to be added directly on the link
How can i accomplish this?
- This topic was modified 7 years, 12 months ago by M|C.
November 29, 2016 at 10:35 am #718145Hey M|C,
When adding class in the menu (via Appearance > Menus) it would be added to li tag, still try to add a unique class to it, for example popup-link-wrap then add this code at the bottom of functions.php:
function add_custom_script(){ ?> <script type="text/javascript"> (function($){ function myfunction() { $("top").find(".popup-link-wrap a").addClass("your-class-here"); } myfunction(); })(jQuery); </script> <?php } add_action('wp_footer', 'add_custom_script');
Just replace your-class-here with the name of the class you want to use.
Best regards,
Nikko- This reply was modified 7 years, 11 months ago by Nikko.
November 30, 2016 at 5:59 am #718627November 30, 2016 at 9:24 pm #718987Hello
December 1, 2016 at 6:52 am #719095Hi,
Please send us a temporary admin login and login URL so that we can have a closer look. You can post the details in the Private Content section of your reply.
Best regards,
RikardDecember 1, 2016 at 9:14 am #719137December 2, 2016 at 7:21 am #719534Hey guys, were you able to check?
December 4, 2016 at 6:30 am #720150December 5, 2016 at 11:10 am #720403Hey!
I have added the code I have given above but I noticed there is already a function of the same name, I modified the code in your functions.php (code below) however when I checked the page source it seems that the cache prevents the new code to show up. I tried disabling the cache but couldn’t get it to work, can you try to clear and disable cache (deactivate also), then delete the cache files via ftp or cpanel.
function add_popup_script(){ ?> <script type="text/javascript"> (function($){ function myfunction() { $(".popup-link-wrap a").addClass("your-class-here"); } myfunction(); })(jQuery); </script> <?php } add_action('wp_footer', 'add_popup_script');
Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.