Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 0 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
add comment

Your Answer

 
discard

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.