Adding Widget Areas to Child Themes (4 posts)

  1. daveisareporter
    Posted 4 years ago #


    I want to create a child theme (of TwentyTen) that has custom widget areas. The problem I'm having is that the child functions.php file, of course, doesn't override its parent theme's functions.php file (unlike style.css).

    Because of this, I'm unable to run the register_sidebars function twice, and thus register new sidebars. I'm wondering if there's a way to add a widget area to a child theme without taking out the register_sidebars function in the parent theme.

    Any help is much appreciated. Thanks!

  2. vtxyzzy
    Posted 4 years ago #

    You can certainly add sidebars in a child theme. You can call register_sidebar() as many times as you need to register your sidebars.

    You will need to create one or more sidebar-mysidebar.php files and place a call to get_sidebar('mysidebar') in the proper template files to actually display each sidebar.

  3. daveisareporter
    Posted 4 years ago #


    I also found the following explanation:

    Is it always necessary to use the add_action hook to register a widget area in a child theme?

  4. vtxyzzy
    Posted 4 years ago #

    I don't think that an action hook is necessary, but it does guarantee that the sidebar registration will be done at the correct time.

    See the Codex article on Widgetizing Themes, and this tutorial.

Topic Closed

This topic has been closed to new replies.

About this Topic