Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJason Baciulis
6,669 PointsIs there a way to add a class to <a> tag using wp_nav_menu() ?
When dealing with Bootstrap framework it's menu has classes "nav-link" for <a> tags. Is it a way to add this class?
Because right now I just have a static menu.
2 Answers
Sue Johnson
16,648 PointsYou can change the classes of individual <a> tags, there is an option under each item if you have created your menu using the custom menu. You will need to click on 'css classes' under screen options (top right hand side) to see the option.
You can also do this using PHP, I believe you have to extend the Walker class, more info here: https://codex.wordpress.org/Class_Reference/Walker
csj
12,678 PointsNot sure I completely understand, but something like this?
<a class="nav-link" href="#">test</a>
When dealing with bootstrap and menus, take a look at a WordPress course about the walker class.