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

Rebecca Jensen
Rebecca Jensen
11,580 Points

Function makes my page 'disappear'. Can you see a mistake in my code?

When I added the following to my functions.php file, my page appeared blank (no admin bar or anything). When I delete the code, my page returns. Do I have a mistake below?

add_theme_support( 'menus' );

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

1 Answer

Hi Rebecca,

By makes your page disappear you mean go blank right? Most of the time when there's a php error the page goes blank.

A couple of possible reasons, the function name is different in the add_action hook parameter (you're just missing an underscore).

Also there's a semicolon that shouldn't be there next to _('Header Menu')

Hopefully that fixes it.

Rebecca Jensen
Rebecca Jensen
11,580 Points

Thanks! My underscore was actually there, but I think this text editor interpreted that as me wanting to make my text Italicized (is there a better way to include code in these questions?).

But, the problem was indeed the semi-colon! Thanks for looking. Sometimes it's hard to see those small differences after you've been staring at it for awhile.