• Resolved eskimopest

    (@eskimopest)


    Im staring to develop a theme but i have a litle issue. I’m trying to add a sidebar to my theme with this code

    function theme_2_widgets_init() {
    	register_sidebar( array(
    		'name'          => __('Sidebar', 'theme_2'),
    		'id'            => 'sidebar-1',
    		'description'   => __('Add widgets here to appear in your sidebar.', 'theme_2' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h4 class="widget-title">',
    		'after_title'   => '</h4>',
    	) );
    }
    add_action('widgets_init', 'theme_2_widgets_init');

    The thing is, when i go to Appearence -> widgets, my sidebar is there but there is an incative sidebar thats says “this sidebar is no longer available and does not show anywhere on your site…”

    is this normal to happen?

Viewing 4 replies - 1 through 4 (of 4 total)
  • This is from my functions.php:

    // Sidebars & Widgetizes Areas
    function JD_bootstrap_register_sidebars() {
    register_sidebar(array(
    ‘id’ => ‘sidebar1’,
    ‘name’ => ‘Main Sidebar’,
    ‘description’ => ‘Main Sidebar’,
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h3 class=”widgettitle”>’,
    ‘after_title’ => ‘</h3>’,
    ));
    register_sidebar(array(
    ‘id’ => ‘social’,
    ‘name’ => ‘Social Bar’,
    ‘description’ => ‘Top Social and Contact info’,
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ));
    register_sidebar(array(
    ‘id’ => ‘footer’,
    ‘name’ => ‘Footer Widget’,
    ‘description’ => ‘Address’,
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s col-sm-12″>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h3 class=”widgettitle”>’,
    ‘after_title’ => ‘</h3>’,
    ));

    } // don’t remove this bracket!
    add_action( ‘widgets_init’, ‘JD_bootstrap_register_sidebars’ ); // This function initializes widgets

    If you remove all widgets from the inactive sidebar, that warning should disappear.

    Thread Starter eskimopest

    (@eskimopest)

    Stanordan, I have this issue but i manage to make a workaround. Dont know why it happens but i copy another theme i was making and just changed the theme slugs. Now all is fine. Dont know why, the from functions.php is exactly the same. Now when i install the new theme the sidebar gets registred and appears with the default widgets inside. Im new to wordpress developement but i guess this is the default behaviour of wordpress when a new sidebar is registred right? nedd to figure out why the sidebar wasent working.

    anyway tks =)

    Thread Starter eskimopest

    (@eskimopest)

    HudsonValleyWebDesign tks but i manage to do a workaround. Still have to see what was causing the issue.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Theme developement – incative sidebars’ is closed to new replies.