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 trialIan Mackenzie
11,062 PointsAfter entering code my backend does not show at all!
<?php
add_theme_support('menus');
function register_theme_menus(){
register_nav_menus(
array(
'primary-menu' => _('Primary Menu')
)
);
}
add_action('init', 'register_theme_menus');
?>
2 Answers
mikes02
Courses Plus Student 16,968 PointsFor register_nav_menus:
"This function automatically registers custom menu support for the theme therefore you do not need to call add_theme_support( 'menus' );"
So, in other words, you don't have to use the add_theme_support('menus') you have. You should be able to use
<?php
function register_theme_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' )
)
);
}
add_action( 'init', 'register_theme_menus' );
?>
I believe your error may be related to the fact that you were only using a single underscore in front of the text you wanted localized, you need to use two underscores __
Give that a try and we can troubleshoot it from there if necessary.
Jill Ferron
5,023 PointsSuper helpful thanks
Ian Mackenzie
11,062 PointsIan Mackenzie
11,062 PointsThanks Mike for your quick response and you nailed it. I was one underscore short.
mikes02
Courses Plus Student 16,968 Pointsmikes02
Courses Plus Student 16,968 PointsGlad it helped, Ian!