Menu: Adding class to a link
-
By default, when using the WordPress menu system to create a nav, it does not add a class to the a href. So adding a class in the menu maker adds it to the li but not the a. Which I need to make a jQuery function work. I tried this method of making the link relationship convert to a class but it’s not working for me. This is the code I’m using in functions.php
function add_menuclass($ulclass) { return preg_replace('/<a rel="nofollow"/', '<a rel="nofollow" class="close-con"', $ulclass, 1); } add_filter('wp_nav_menu','add_menuclass');
What can I do to make my class add to the a elements besides the li?
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Menu: Adding class to a link’ is closed to new replies.