Skip to main content
2 of 2
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/

Is there a way to add widgets anywhere in a site,...

No. Widgets are added to sidebars. Sidebars are displayed by the theme. That sidebar code is hard coded into the theme. There are examples in the Codex.

There is no way to "map" a sidebar to just anywhere you want in the theme. What that would mean would be opening the PHP template files programatically and editing the code into them, or capturing the output and parsing the page before it renders (very hard and very resource intensive).

There might be hooks in the theme that you can use. SOmething like:

function add_my_sidebar() {
  dynamic_sidebar( 'my-special-sidebar' );
}
add_action('some_theme_hook','add_my_sidebar'):

But is unlikely you'll find the hooks you want where you want them.

If this is important to you, make a child theme. Hopefully, your theme is written proper to support that.

s_ha_dum
  • 65.5k
  • 13
  • 84
  • 174