May
9
9
Add a span around WordPress menu links
I often have the requirement to add an additional element in the standard WordPress menu – usually adding a span around the anchors.
This is very easy to do using the link_before and link_after functions:
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary', 'link_before' => '<span>', 'link_after' => '</span>') ); ?>
Depending on your theme, you’ll probably find this code in header.php.






