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

Bas Kardinaal
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Bas Kardinaal
Front End Web Development Techdegree Graduate 18,029 Points

Container set to false not working.

In the video Zac Gordon tells to add this argument to remove the wrapper div, for me this is not working.

container => false

i also tried

container => ''

My header.php

<?php

$defaults = array(
     'container' => false,
    'theme_location' => 'primary-menu',
);
wp_nav_menu( 'defaults' );

?>

My functions.php

add_theme_support( 'menus' );

function register_theme_menus() {

    register_nav_menus(
        array (
            'primary-menu' => __( 'Primary Menu' )
        )
    );

}
add_action( 'init', 'register_theme_menus' );

5 Answers

Same for me Bas. Pretty poor that this hasn't been answered by some kind of admin as I've seen this problem a few times with no answer. I do see that in your code there is a comma that you need to remove from the last part of the array : 'theme_location' => 'primary-menu'

Solved it Bas. You need to go to manage locations in the menu are of the admin and at the bottom assign the menu to primary menu - then it will work.

Bas Kardinaal
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Bas Kardinaal
Front End Web Development Techdegree Graduate 18,029 Points

Thanks for your reply Robert. When i go to the tab menu locations i have already selected the Primary Menu from the dropdown. I even called the menu Primary Menu. I still see the container around the ul element. What could it be?

Christopher Estes
Christopher Estes
1,132 Points

Try "wp_nav_menu( $defaults );" in header.php