First of all this is my first wordpress theme where im making

So i want to add class to <a> and <span> in navbar

and want to looks like this

<a class="menu_top" href="/feedback/"><span>Contact</span></a>
<a class="menu_top" href="/lastnews/"><span>News</span></a>
<a class="menu_top" href="/dmca/"><span>DMCA</span>

instead of this

<ul><li class="page_item page-item-2"><a href="/feedback/">Contact</a></li>
<li class="page_item page-item-8"><a href="/dmca/">DMCA</a></li>
<li class="page_item page-item-6"><a href="lastnews/">News</a></li></ul>

Thats i do is to get rid of <li> using

$menuParameters = array(
  'container'       => false,
  'echo'            => false,
  'items_wrap'      => '%3$s',
  'depth'           => 0,
echo strip_tags(wp_nav_menu( $menuParameters ), '<a>' );

and curently i have code like this in my output:

<a href="/feedback/">Contact</a>
<a href="/dmca/">DMCA</a>
<a href="/lastnews/">News</a>

Waiting for your answers thanks!

  • Have you seen How does a minimal menu walker look like? That would be fastest and most simple solution. – fuxia Jun 13 '15 at 23:42
  • yes i have try to make like 3 times walker but cant get to work, its still confused – user2610360 Jun 13 '15 at 23:49
  • You can just copy my example and add your class attribute. – fuxia Jun 14 '15 at 0:37

Your Answer

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

Browse other questions tagged or ask your own question.