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 WordPress Theme Development Building Out WordPress Navigation Coding A Basic Navigation in WordPress

Andrew Wagner
Andrew Wagner
786 Points

When I do this, WP is still adding a <div> to the code. What am I doing wrong?

My code is:

<nav id="nav"> <?php $defaults = array( 'container' => false, 'container_class' => false, 'theme_location' => 'primary_menu');

    wp_nav_menu($defaults);
?>

And it is still adding a <div>. I've tried it with and without 'container_class', and with different values for false, including ''. What's going on here? I'm on WP version 4.

Thanks

3 Answers

Andrew Wagner
Andrew Wagner
786 Points

I figured out what I was doing wrong. I had a typo, I was calling menu primary_menu instead of primary-menu. When I changed that, everything worked properly.

Peter Makowski
Peter Makowski
11,244 Points

Made exactly the same typo. Ha!

Me Three!