How to add a class in anchor tag on my custom menu?
-
[ Moderator note: moved to How-to and Troubleshooting. ]
Hello,
My navigation menu goes like this:<ul class="menu" id="menu-navigation-desktop"> <li class="menu-item menu-item-type-post_type menu-item-object-page top-menu-item"><a class="top-menu-item-a" href="#"><span>Home</span></a></li> <li class="menu-item menu-item-type-post_type menu-item-object-page top-menu-item top-menu-item-has-sub-menu"><a class="top-menu-item-a top-menu-item-has-sub-menu-a" href="#"><span>About Us</span></a> <ul class="sub-menu"> <li class="menu-item menu-item-type-post_type menu-item-object-page"><a href="#">Mission</a></li> <li class="menu-item menu-item-type-post_type menu-item-object-page"><a href="#">Objectives</a></li> </ul> </li> </ul>
How can I insert a class top-menu-item-a on my anchor tag only on my parent menu not in submenus. And I need to display inline (horizontally). Now menus are displayed vertically. I’ve inserted <span> tag by using this code.
<?php $arg = array( 'menu' => 'main_menu', 'menu_class' => 'menu', 'link_before' => '<span>', 'link_after' => '</span>', 'container' => '' ); wp_nav_menu( $arg ); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to add a class in anchor tag on my custom menu?’ is closed to new replies.