Disclaimer: I am brand spanking new to WP.

I am using the Starkers HTML5 framework theme. In the functions.php I see this code:

function starkers_widgets_init() {

  // Area 1, located at the top of the sidebar.
  register_sidebar( array(
    'name' => __( 'Primary Widget Area', 'starkers' ),
    'id' => 'primary-widget-area',
    'description' => __( 'The primary widget area', 'starkers' ),
    'before_widget' => '<li>',
    'after_widget' => '</li>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
  ) );

  // Area 3, located in the footer. Empty by default.
  register_sidebar( array(
    'name' => __( 'First Footer Widget Area', 'starkers' ),
    'id' => 'first-footer-widget-area',
    'description' => __( 'The first footer widget area', 'starkers' ),
    'before_widget' => '<li>',
    'after_widget' => '</li>',
    'before_title' => '<h3>',
    'after_title' => '</h3>',
  ) );

  // ... more calls to register_sidebar() ... 

And in footer.php I see this code:

<?php get_sidebar( 'footer' ); ?>

I don't understand how get_sidebar() knows how to take that string argument and find the appropriate widgets that were defined by register_sidebar(). In the functions.php snippet I posted above. There isn't any mention of "footer" except for the name, id and description properties. But it would seem odd to me that get_sidebar() would search for 'footer' inside those properties.

Does this make sense what I am asking? Is there some missing piece?

The reasons I am asking is because - I would like to know more about the WP architecture - I would like to be able to define a custom widget area and know how to render it on a specific page.

Thanks a ton.

4 Answers 4


You just call get_sidebar() from index.php and it loads the theme file sidebar.php.

register_sidebar(), on the other hand, is used for widgets where plugins and such want to dynamically add content in your sidebar.php file if your theme supports it.

In your case, is there a file called sidebar-footer.php in your theme's directory?


I've never bothered with get_sidebar(). Instead I just use dynamic_sidebar(). You'd call it like this:


And that takes care of the whole sidebar. No more file inclusions, no more cluttered theme folders. If I want to have 5 different sidebars, it doesn't add any files, only extra functions in functions.php.

  • In the case of Starkers, sidebar-footer.php conditionally calls dynamic_sidebar() for all the appropriate widget areas.
    – user66
    Aug 18, 2010 at 19:27
  • That may be true, but if you know the version you're running, there's no need to conditionally call it, and why run an include if you can just call the function directly? Aug 18, 2010 at 19:30

get_sidebar('name') gets a sidebar template of the name sidebar-name.php .

Within sidebar-name.php, there is the HTML for the sidebar, and a call to dynamic_sidebar('some-name-hopefully-the-same'), which is where the widgets will go.

register_sidebar(array(name=>'some-name-hopefully-the-same', ...)) is what allows dynamic_sidebar to work.

As you can see, get_sidebar(templatename) is for use with sidebar-templates. If you have no need for them, you can just call dynamic_sidebar(sidebarname) directly from your theme.


get_sidebar('footer') attempts to load sidebar-footer.php from the active theme. Starkers does provide this file. Check starkers/sidebar-footer.php and things should become clear.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.