Get Each Menu Nav Label of Menus in HTML tag
Question
I have footer menus built with wp_nav_menu
using code below:
wp_nav_menu(
array(
'container' => '',
'depth' => 1,
'items_wrap' => '%3$s',
'theme_location' => 'footer',
'link_before' => '<span content="">',
'link_after' => '</span>',
)
);
and the HTML output like the following:
<ul class="footer-menus">
<li id="1"><a title="A" href="https://localhost/A/"><span content=""></span>A</a></li>
<li id="2"><a title="B" href="https://localhost/B/"><span content=""></span>B</a></li>
<li id="3"><a title="C" href="https://localhost/C/"><span content=""></span>C</a></li>
</ul>
the question is how to fill the tag <span content
where the content
tag is the menu nav label that same with the li
tag have, so the HTML output will be like this:
<ul class="footer-menus">
<li id="1"><a title="A" href="https://localhost/A/"><span content="A"></span>A</a></li>
<li id="2"><a title="B" href="https://localhost/B/"><span content="B"></span>B</a></li>
<li id="3"><a title="C" href="https://localhost/C/"><span content="C"></span>C</a></li>
</ul>
Any help appreciated. Thanks!
0
2 years
2021-03-22T02:56:08-05:00
2021-03-22T02:56:08-05:00 0 Answers
0 views
0
Leave an answer