WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I stumbled upon avery strange problem while creating a sidebar for my wordpress theme using the get_sidebar() function in header.php.

I inserted the following code in function.php:

function myfunc_sidebars_init() {
        'name' => __('Main Sidebar', 'mytheme'),
        'description' => __('Widget area for the main sidebar.', 'mytheme'),
        'id' => 'sidebar-main',
        'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widget-title">',
        'after_title' => '</h3>',
add_action( 'widgets_init', 'myfunc_sidebars_init' );

My sideber.php looks like this:

<div id="sidebar1" class="fluid-sidebar sidebar span4" role="complementary">

<?php if ( is_active_sidebar( 'sidebar1' ) ) : ?>

    <?php dynamic_sidebar( 'sidebar1' ); ?>

<?php else : ?>

    <div class="alert alert-message">

        <p><?php _e("Please activate some Widgets","mytheme"); ?>.</p>


<?php endif; ?>


I also selected the sidebar in Appearance->Menus in the admin panel and all default widgets are added to the sidebar in Appearance->Widgets (Search, Recent Posts, Recent Comments, etc.).

However after loading the theme there is an alert in the sidebar menu saying "Please activate some Widgets". Why is that and how can I fix it?

share|improve this question
up vote 1 down vote accepted

You've changed from sidebar-main in your myfunc_sidebars_init() to sidebar1 in sidebar.php. Change sidebar.php to use

<?php if ( is_active_sidebar( 'sidebar-main' ) ) : ?>

    <?php dynamic_sidebar( 'sidebar-main' ); ?>
share|improve this answer
Oh, thanks! That was very stupid mistake of mine.. – Ziik Jun 27 '13 at 13:01
I've chased down typos like that for hours before. Now I tend to look for stuff like that first. – Pat J Jun 27 '13 at 13:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.