I posted another question about CSS but came to the solution of adding span tags to the title of the links in the navigation menu. What I have is:
<div>
<li>
<a>
About me
</a>
</li>
</div>
I wanted something like:
<div>
<li>
<a>
<span>
About me
</span>
</a>
</li>
</div>
Then I found that I could probably try using
wp_nav_menu( array(
'link_before' => '<span>',
'link_after' => '</span>'
)
);
This proceeded to break my site, causing all menu dropdown items to simply display on screen in addition to the "normal" nav bar I have.
The error I got was: "Cannot modify header information - headers already sent by (output started at /public_html/wp-includes/nav-menu-template.php:256) in /public_html/wp-includes/pluggable.php on line 1210"
nav-menu-template.php 256 is echo $nav_menu;
pluggable.php 1210 is header("Location: $location", true, $status);
I'm at my wits end. Anyone who remotely knows what's going on, please help. Thank you very much in advance!
OK guys, I finally got it.
I just edited this file:
public_html/wp-includes/nav-menu-template.php
Within you will see
$defaults
and you should simply editlink_before
andlink_after
:$defaults = array( ...'link_before' => '<span>', 'link_after' => '</span>', ...);
This should get the theme to push
<span>NAVIGATION LABEL</span>
into all your nav menu items.Hope this helps.