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 trial

WordPress

How to float the main menu right?

Normally in Bootstrap I can just add navbar-right to the source code but I can't figure out where the ul tag is in the html code because Wordpress is dynamic. Can someone help me? Here's what the tag looks like when I inspect it <ul id="menu-primary-menu" class="nav navbar-nav">.

2 Answers

mathisvester
mathisvester
13,451 Points

The navigation markup is usually specified in the header.php of your theme. According to Wordpress function wp_nav_menu() you are able to add an array of nav menu arguments. Within these arguments you can set a menu_class which controls the class names of the unordered list element. At this point you should add the navbar-right class.

mathisvester is correct, and to add. In the wp_nav_menu() function if you are using bootstrap add the correct bootstrap classes to the nav menu and then you should have a working bootstrap nav.

Brian Jensen
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Brian Jensen
Treehouse Staff

Without seeing the full code I can't be 100% sure, but try adding this to your custom css file.

#menu-primary-menu {
  float: right;
}