How to Widget Enable WordPress Themes in 3 Easy Steps (2026)

How do you widget enable WordPress themes that don’t have a sidebar or footer widget area? Back in 2007 we added widgets to our heavily customised Blix theme in three steps, and the same idea still works in 2026: register a widget area in functions.php, show it in your template, then add widgets from the dashboard. Here’s the current code, plus what changed with the block widget editor and block themes.

Widget enable WordPress themes

Quick answer: To widget enable WordPress themes, register a widget area with register_sidebar() inside a function hooked to widgets_init in your (child) theme’s functions.php, then display it with dynamic_sidebar( 'your-id' ) in sidebar.php or another template. Finally, add widgets under Appearance > Widgets. Block themes don’t use widget areas; edit their template parts in the Site Editor instead.

Step 1: Register a widget area in functions.php

Add this to your child theme’s functions.php:

function qot_widgets_init() {
    register_sidebar( array(
        'name'          => __( 'Main Sidebar', 'qot' ),
        'id'            => 'sidebar-1',
        'description'   => __( 'Widgets in the right sidebar.', 'qot' ),
        'before_widget' => '<section id="%1$s" class="widget %2$s">',
        'after_widget'  => '</section>',
        'before_title'  => '<h4 class="widget-title">',
        'after_title'   => '</h4>',
    ) );
}
add_action( 'widgets_init', 'qot_widgets_init' );

The before_title and after_title settings let you match your theme’s markup; we used h4 titles in our sidebar. The %1$s and %2$s placeholders give each widget a unique ID and class for styling. Our older 2007 and WordPress 3 code hooked into init; widgets_init is the correct hook. Call register_sidebar() again with a different id for each extra area, such as a footer.

Step 2: Show the widget area in your template

In sidebar.php (or footer.php), add:

<?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
  <aside class="widget-area" role="complementary">
    <?php dynamic_sidebar( 'sidebar-1' ); ?>
  </aside>
<?php endif; ?>

is_active_sidebar() prints nothing when the area is empty, so you don’t get blank boxes.

Step 3: Add widgets in the dashboard

Go to Appearance > Widgets or Appearance > Customize > Widgets. Since WordPress 5.8 this screen uses the block editor, so you can add any block (paragraph, image, latest posts, search, custom HTML) as well as classic widgets. Drag them into Main Sidebar and click Update. Prefer the old drag-and-drop screen? Install the official Classic Widgets plugin.

Widget enable WordPress themes vs block themes

Block themes such as Twenty Twenty-Five don’t have widget areas at all. Instead, open Appearance > Editor > Patterns > Template parts, edit the sidebar or footer part, and add blocks directly. If you want a sidebar on a block theme, add a Columns block to the single post template and put your blocks in the side column.

Tips for better widget areas

  • Use a child theme so theme updates don’t erase your functions.php changes.
  • Keep sidebars light: heavy widgets and third-party scripts slow every page.
  • Show different widgets on different pages by registering several areas; see how to create multiple dynamic sidebars.
  • Theme features go together: while editing functions.php, you can also add post thumbnails to your theme.

Frequently asked questions

Why don’t I see Appearance > Widgets?

Your theme hasn’t registered any widget areas, or it’s a block theme. Register one as shown above, or use the Site Editor.

Do I need a plugin to add widgets?

No. Widgets are built into WordPress. Plugins only add extra widget types.

Can I put widgets in the footer?

Yes. Register a second area (for example footer-1) and call dynamic_sidebar( 'footer-1' ) in footer.php.

Is the old register_sidebar() code still valid?

The function is the same, but always pass an id and hook it to widgets_init; WordPress warns about sidebars registered without an ID.

Found this useful? Share it with someone who needs it.

Get our free weekly email: new tech guides and tools, no spam.

New and updated tech guides, a free tool worth bookmarking and one useful pick, once a week. No spam, unsubscribe anytime.

One email a week. Unsubscribe anytime. See our privacy policy.

Fresh Tech Guides

Leave a Reply

Your email address will not be published. Required fields are marked *

36 Comments

  1. This is the first time I am using WP. I am using WP / Jobroller. It allows widgits down the right side, just like this page. How do I get it to allow widgits down the left side or is that possible?

  2. superb!!!!!!!! i just have to comment to say thank you. this is the easiest, most effective tutorial ever. i read your guide and implement on my site at midnight while being on a stage of half-sleeping, eyes half-closing. I copy, paste, ftp and voila, it WORKED…
    can’t believe it.

    Thanks.

  3. I have purple Aura theme and I have tried your suggestion and it wont work, any other suggestions?

  4. Why don’t you use the unordered list? I did this sometime ago but stayed with H2 even though I know it might hurt my SEO. Lately I’ve been finding too many plugins even official ones like WordPress Importer barf with non-standard WordPress installs. It is getting harder and harder to go against the grain after all these years of using WordPress. I’m making a version of my theme with unordered list and one without I think.

  5. Hey there,

    Good article and very clear. Can I also propose the use of the Widgets on pages plugin which allows you to add/remove and manage sidebars via the admin pages. These sidebars can then be added to the theme with 1 simple template tag.

    Hope this is of some use.
    Todd

  6. Hi there.

    Please help. I want to make a website and use different website for diferent pages, but I did not know how to use. For example. I want to use for sidebar2 to make a picture that will continue on the from the content on the sidebar 2 but dont know how to make the page…

    Thank you for your help !

  7. I gave this a shot, and this error msg popped up:
    error: syntax error, unexpected $end in /home/alvinthe/public_html/blog/wp-content/themes/nami/sidebar.php on line 46

    I have a feeling its a simple fix, but im not sure what.

  8. How to make a widget placeholder other then the sidebars. Like i want to place a widget placeholder after the body tag. How can i do that?

  9. I’m new to wordpress and trying to hit the ground running with the functions.php file to add widgets to a happy holidays theme. Thank you all for the help.

  10. Thanks for the code snippets above, as these are gonna make implement some sidebar widgets heaps easier..

    Many thanks

  11. I’ve have the same problem as sergio, with exactly the same mistakes.. I have NO spaces or anything in functions.php – what the heck is wrong?

  12. so now is too nice that
    now how can i add a widget in header tempalte website?
    because i can addd widget only to right and left

    how can i put one in header page ??
    for example i would like to add language translator widget in header .

    cheers.
    L.

  13. That was indeed a good post for beginners…many years to come dude..keep going…

    Your best friend ramesh

  14. Thank you so much for this post…It is really helpful..

    My sidebar problem was solved in less that 10 minutes…thank you!:D

  15. Thanks a lot for this information, I just started with WP today and was disappointed when I saw that widgets wouldn’t work with the theme I had chosen. Well, it’s fixed now thanks to you!

  16. Sidebars were added to the theme and I can select widgets for them, but the changes aren’t saved.

    Error is following:

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/q/w/e/000000/html/wp-content/themes/Sumo/functions.php:21) in /home/content/q/w/e/000000/html/wp-includes/pluggable.php on line 850

    1. I think you have a blank space at the top of function.php. Please remove and keep us updated here.

      Thanks.

  17. Yeah great article, got different ones called up in page templates and a 3 col footer widget !
    so sidebars change content depending on the page content.

    just a huge question though, lost my original styling for the sidebar do i need to re-style them some how through style.css? how would i do that?

    I have named them
    home
    blog
    gallery ect..

    any help would be great !

  18. Thanks for the tips, but I’m very new to CSS. Where do I create the functions.php page? Do I need custom css? Or anyone of the available themes from WordPress will do?

  19. I have a widget ready template. But whenever I activate my widgets, It overrides my sidebar.php and removes the background. What should I do to preserve the background of sidebar.php and append the widgets added?

    1. I have the same problem. I’ve added a bunch of widgets to my sidebar by editing the code, but can’t drag and drop widgets from the Widget section of my dashboard. When I do, everything else on my sidebar gets wiped out.

      Any ideas how to get around this?

      I’m using the monochrome theme by monolab …

  20. It is functions.php and not function.php
    Also you need to place it in the theme folder you are currently using.

    1. This was a major problem for me, I had been trying to make sidebars work. Then I read this.

      function.php <- I had this… :)

      functions.php <- Changed to this and it worked like a charm.

  21. I’m using the theme called Iridium. When I click the widget, the below message appear: No Sidebars Defined You are seeing this message because the theme you are currently using isnt widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please follow these instructions. Is your steps will fix this? I actually tried to create a function.php like you mention. But when I clicked on the widget, the above message still appear. Do you know how to fix this? Thanks.

  22. This is a simple method everyone can follow, I too had added the third sidebar to my blog previously using this method.

  23. JP – I have been using lots of multiple sidebars and its a great feature. The multiple sidebars tutorial is coming soon…

  24. It’s also really easy to add multiple sidebars to a theme. You can simply add the following line after “register_sidebar(array(“:

    'name'=>'Sidebar 1',

    You can add multiple sidebar sections to functions.php, for example, “Sidebar 1”, “Sidebar 2” and so on. You then need to call specific sidebar in your template file like so:

    —
    JP

    1. This is very usfull, thanks!!
      But how do you call the specific sidebar?