Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i wana add custom class to anchores in wp_nav_menu outputs.

default for example is :

<li id="menu-item" class="menu-item menu-item-type-custom">
<a href="http://example.com">example</a>
</li>

i wana this :

<li id="menu-item" class="menu-item menu-item-type-custom ">
<a href="http://example.com" class="class">example</a>
</li>
share|improve this question

1 Answer 1

You can add classes natively via interface in admin. Open Screen Options (top right of the screen) and check CSS Classes. I don't remember if class applies to link itself, but you can always target link inside container with CSS (.class a).

share|improve this answer
    
classes applies only in li tag. but using. –  hosein Jul 29 at 14:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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