2

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 ?

2

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);
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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