I'm registering Sidebars for my theme in the following way.
<?php add_action( 'widgets_init', 'bereishit_register_footer_sidebar' );?>
<?php
function bereishit_register_footer_sidebar() {
register_sidebars(5,
array( 'name' => 'Footer %d',
'id' => 'footer-%d',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
}
?>
From footer.php am trying to display the sidebars
<?php
/*
* Footer Sidebar
*/
get_sidebar( 'footer' );
?>
sidebar-footer.php
is as follows
<?php
/*-----------------------------------------------------------------------------------*/
/* The template for displaying the footer sidebars. */
/*-----------------------------------------------------------------------------------*/
?>
<?php
/* The footer widget area is triggered if any of the areas
* have widgets. So let's check that first.
*
* If none of the sidebars have widgets, then let's bail early.
*/
for ($i=1; $i<=5; $i++)
{
if ( ! is_active_sidebar( sprintf(__('footer-%d'), $i )))
{
echo 'here I am returning';
echo sprintf(__('footer-%d'), $i );
return;
}
}
// If we get this far, we have widgets. Let do this.
echo 'here I am';
?>
but not able to show the sidebar "is_active_sidebar" is failing for some reason. And the widget that i had added is disappearing :-(