0
votes

I have developed a Premium theme, but as soon as theme is installed wordpress by default throw some of its widgets in Header Area.

The theme looks very ugly at it first appearance when it is virgin w/o all the theme settings.

Although those widgets can be deleted mannualy from the Widget area of Header, but initially the buyer of that theme wouldn't get a Good Notion.

I want to disable wordpress few default widgets in one particular side bar.

I tried various things and researched on various forums.

I got few solutions such as : WordPress widgets can be completely disabled, but that what I do not want.

Has any one faced the same challenge like me. Please advice.

Summary of The Question: I want to disable wordpress default widgets in only one particular sidebar/widget area.

Thanks!

1
Why don't you register a custom widget area (called 'Header Widgets'), and assign it to your header. That way you won't have the primary sidebar loaded in your header with default widgets preassigned to them.dingo_d
Actually my theme has 26 custom widget area. The header widget area is at the top and when new theme is installed wordpress throw all its default widget there and thats what i am trying to get rid of. I do not want and default widgets during installation in that area.user1864913
Then just register additional custom widget above it that won't be used.dingo_d

1 Answers

0
votes

register a custom area for your header

function theme_widgets_init() {
        register_sidebar(array(
            'name' => __('Header widget', 'theme'),
            'id' => 'sidebar-1',
            .............
            .............
        ));
    add_action('widgets_init', 'theme_widgets_init');

and output it in your header like that:

<?php dynamic_sidebar('sidebar-1'); ?>