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!

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 How to Make a Website with WordPress WordPress Widgets and Custom Menus How to Create Widgetized Areas in WordPress

Zach Elkins
Zach Elkins
9,602 Points

Is there a specific way to list the information in the create_widget function?

When it comes to the create_widget function I see that it is written as so

create_widget ("Header", "uptop", "Displays in the header of the site, above the title");

Is the "Header" portion the name that will always appear in the Widget page of the control panel and the "uptop" portion the actual name that you will use to link the CSS with for styling?

And the last portion simply the description?

Essentially the "uptop" part has no further use aside from being used as the name?

2 Answers

Zac Gordon
Zac Gordon
Treehouse Guest Teacher
// Function for creating Widegets
function create_widget($name, $id, $description) {

        'name' => __( $name ),    
        'id' => $id,
        'description' => __( $description ),
        'before_widget' => '<div id="'.$id.'" class="widget %1$s %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3>',
        'after_title' => '</h3>'


// Create the actual widgets
create_widget("Header", "uptop", "Displays in the header of the site, above the title");

If you look at the parameters you can see they are the name, id and description. The name and description are as you mentioned. The ID is how you would refer to or call the widget area in your template code.

Zach Elkins
Zach Elkins
9,602 Points

Cool! I wasn't sure if I was understanding it correctly. Thank you!