• I would like to add a <span> to each of the menu links in my primary menu. I am a coder so I just need to know what file and line to edit – can anybody help me add this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I think that is a bootstrap based theme so you will have to find either in header.php where the bootstrap menu structure is defined or go into the theme’s navwalker file and modify the menu items structure there.

    The functions.php will tell you where the navwalker file lives.

    I added this code to my navwalker file to add the ability to put the link’s description element inside a span:

    // add support for menu item descriptions
    		if (strlen($item->description)>2) {
    	      	$item_output .= '</a> <span class="sub">' . $item->description . '</span>';}

    Do not edit the theme itself. First create a child theme for your changes.

    @jaycbrf @esmi I hope you are well today and thanks for helping out here in this forum.

    Your help here is really appreciated.

    Thread Starter pddiaz

    (@pddiaz)

    right now I’ve added my <span> inside the menu link title, not ideal. Anybody know how I can add it to the navwalker file to include it in the code?

    the code I added above goes into the navwalker file

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘add to each navigation item’ is closed to new replies.