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

Briar Bouthot
Briar Bouthot
5,356 Points

add_theme_support('menus'); = not working

Am I missing something here? In my functions.php I have the following:

<php

add_theme_support( 'menus' );


?>

2 Answers

The WP Codex says this should go in an action hook. See Function Reference/add theme support.

Try this instead.

<?php

function add_menu_support() {
    add_theme_support( 'menus' );
}
add_action( 'after_setup_theme', 'add_menu_support' );

?>
Edward C. Young
Edward C. Young
10,323 Points

This structure should only be used if theme support needed requires more than 1 item. Of particular importance to the OP's question is:

Must be called in the theme’s functions.php file to work. If attached to a hook, it must be β€˜after_setup_theme’. The β€˜init’ hook may be too late for some features.

The add_theme_support function is part of Core and doesn't necessarily need to be called from another function. I believe the OP will fix the problem by moving the function to the top of the functions file.

Alejandro Hernandez
Alejandro Hernandez
7,629 Points

Whats your intention? Are you trying to add wp navigation?

If so you might want to reference this: http://codex.wordpress.org/Navigation_Menus