Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

What is the difference with get_sidebar() and dynamic_sidebar()?

I was wondering which one I should use. Maybe one use widgets and the other one doesn't?

share|improve this question

closed as not a real question by Chip Bennett, Wyck, Michael, s_ha_dum, toscho Jan 17 '13 at 17:47

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Have you read the get_sidebar() and dynamic_sidebar() Codex entries? – Chip Bennett Jan 17 '13 at 17:03
This question is useful as the difference is not clear at all after reading the WP documentation twice… – feeela Sep 18 '14 at 12:52
Having just read through some docs and a tutorial, I still had to view an example and do some detective work. Nothing ambiguous about the question at all. Please see my answer in a more specific and cluttered but essentially the same question:… – Gerard ONeill Sep 10 at 18:32

1 Answer 1

up vote 3 down vote accepted

Please refer to the get_sidebar() and dynamic_sidebar() Codex entries.

The get_sidebar( $slug ) template tag includes the sidebar-$slug.php template-part file.

The dynamic_sidebar( $slug ) template tag outputs the $slug dynamic sidebar, as defined by register_sidebar( array( 'id' => $slug ) ).

share|improve this answer
so....what's the difference? – user25893 Jan 17 '13 at 20:46
get_sidebar always looks for a template file. dynamic_sidebar only looks for the associated register_sidebar details and widgets configured in wp-admin – here Sep 9 at 0:27
get_sidebar(templatename) is for loading a sidebar-template of the name 'sidebar-templatename.php', which would have dynamic_sidebar(sidebarname) in it. If you don't need the template, you can place dynamic_sidebar directly in your theme or other area. Beware, get_sidebar contains hooks that won't get called if it isn't used. – Gerard ONeill Sep 10 at 18:37