WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Am using the custom menu widget to add a menu in the footer and i want to add a in the menu how can i do this ?

like so...

<li><a href=""><span>menu1</span></a></li> 

if done it for the main nav using the link before below but as this is a widget am not sure where to add this

'link_before' => '<span>',
'link_after' => '</span>'

any one know ?

share|improve this question
up vote 1 down vote accepted

Filter 'walker_nav_menu_start_el' and replace the link text.

Prototype, not tested:

add_filter( 'walker_nav_menu_start_el', 'wpse_56028_title' );

function wpse_56028_title( $item )
    return preg_replace( '~(<a[^>]*>)([^<]*)</a>~', '$1<span>$2</span></a>', $item);
share|improve this answer
toscho thanks, that worked – Dan Jun 22 '12 at 11:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.