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 Create Bootstrap Styled Theme Templates Creating a Basic Blog Listing Template

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Should Widget names not be showing up in Widget Area?

Should Widget names not be showing up in Widget Area?

'widgets'

I keep setting up new widgets for this course, however When Zac does it, he gets the name of the Widget area as well as it's description. All I get is what's in the above image.

Here's my functions.php file that sets up the widget.

//Create Widget(s)
function create_widget($name, $id, $description) {
    register_sidebar(array(
        'nameOfWidget' => ($name),  
        'id' => ($id),  
        'description' => ($description),
        'before_widget' => '<div class="widget">',
        'after_widget' => '</div>',
        'before_title' => '<h3>',
        'after_title' => '</h3>'        
    ));
}
//give the widget a name, a unique identifer and short description
create_widget('Front Page Left','front-left','Displays on the left of the home page');
create_widget('Front Page Center','front-center','Displays on the center of the home page');
create_widget('Front Page Right','front-right','Displays on the right of the home page');

create_widget('Page Sidebar','page','Displays on the side with pages with a sidebar');
create_widget('Blog Sidebar','blog','Displays on the side of posts with a sidebar');
?>

I now have 5 widgets each with their name, identifier and description but currently only the description shows up to distinguish them. All the Widgets I have work as they should but they don't show up the same as way as in the videos. Is this normal for Wordpress 4.4?

Thanks :)

2 Answers

Dale Severude
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,349 Points

Hi Jonathan,
The 'nameOfWidget' name used in your register_sidebar array should be just 'name'.

        'name' => __( $name ),

Then the names should show up correctly.

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Thanks Dale.

I'm going to look back and see where I got the idea for nameOfWidget. But thanks for your response, they widget names appear properly now :-)