WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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: wordpress.stackexchange.com/questions/500/… – Gerard ONeill Sep 10 '15 at 18:32
up vote 5 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 '15 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 '15 at 18:37