add_theme_support(‘my-custom-feature’)

You have to register the sidebars in the parent theme just late later enough. Use a hook that runs later, and child themes can register their theme support.

Child theme

add_action( 'after_setup_theme', 'register_header_sidebar_support' );

function register_header_sidebar_support()
{
    return add_theme_support( 'header-sidebar' );
}

Parent theme

add_action( 'wp_loaded', 'register_theme_sidebars' );

function register_theme_sidebars()
{
    if ( current_theme_supports( 'header-sidebar' ) ) 
        register_sidebar(
            array (
                'name' => __( 'Header', 'parent_theme_textdomain' )
            )
        );
}

Leave a Comment