I have a theme created from scratch.I am able to create custom sidebar area and add widgets to it.

But when i give this in index.php

<?php get_sidebar(); ?>

it shows some widgets rendered in that side bar (front end). but in the backend the there is no widget area like that nor the widgets assigned. I think it's rendering some default widgets

How can i enable that sidebar? what am i missing?

what doesget_sidebar() outputs without any custom side bar it passed to it? where are widgets are added to that side bar area.it is not showing


1 Answer 1


There is no 'default sidebar area' in WordPress. It's entirely up to themes to register whatever widget areas they need. So you will need to use register_sidebar() to create the areas for widgets to be added ('sidebars'). Then in your theme you need to use dynamic_sidebar() to output those widgets.

The get_sidebar() function is the equivalent of get_header() and get_footer(), but for sidebar.php. As described in the documentation:

Includes the sidebar template for a theme or if a name is specified then a specialised sidebar will be included.

For the parameter, if the file is called "sidebar-special.php" then specify "special".

If you do not have a sidebar.php file then get_sidebar() will output a default set of widgets. This is purely for backwards compatibility purposes, as it used to be how sidebars worked. This behaviour is now deprecated and you should properly define your sidebars in your theme.

Please note that this is all described in great detail in the documentation. If you are developing a theme there is no excuse for not reading the docs.

Your Answer

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