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 From Bootstrap to WordPress Setup a Bootstrap Theme Creating Bootstrap Navigation in WordPress

Ronny Ewanek
Ronny Ewanek
4,385 Points

Problems adding menu

When I enter this code from the tutorial, I get the following error message:

Parse error: syntax error, unexpected 'menus' (T_STRING) in C:\xampp\htdocs\Bootstrap\wordpress-3.9.1\wordpress\wp-content\themes\bootstrap-to-wp\functions.php on line 32

When I comment this code out, the them loads. Any insight?

add_theme_support( 'menus' ); 

function register_theme_menus() {
    register_nav_ menus(
                    array(
                             'header-menu'  => __( 'Header Menu' )
                              )
                        );
}
add_action( 'init', 'register_theme_menus' );

1 Answer

For a custom WP theme I made I only used the following code for my custom menu and it works.

function register_my_menu() {
  register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action( 'init', 'register_my_menu' );

Hope it helps!