Multiple sidebars – showing up in widget area but not on live site
-
Hi there,
I’ve just generated a theme using underscores and am trying to figure out why my sidebars aren’t showing up. . .
I have registered 2 sidebars in my functions file like so:
function creativeandcurlyv5b_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Primary Sidebar', 'creativeandcurlyv5b' ), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => __( 'Front Page Sidebar', 'creativeandcurlyv5' ), 'id' => 'sidebar-2', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'creativeandcurlyv5b_widgets_init' );
. . . and then chose to do an if else on several of my theme files (index, archive, page, search), which in retrospect probably doesn’t really make much sense at all :
<!-- MULTI SIDEBARS --> <?php if ( is_front_page() ) { // This is the front page index, display the regular sidebar get_sidebar( 'Front Page Sidebar' ); } else { // This is not the front page, display the regular sidebar get_sidebar(); } ?> <!-- END MULTI SIDEBARS -->
I was considering making a homepage / front page template, (making no need for the multi sidebar if/else statements on all of those templates) but I was a tad confused with how wordpress differentiates between is_home() and is_front_page() . . . on my blog, the homepage is the 5 or so most recent posts, not a static page.
Any help anyone can lend here would be greatly appreciated!
Thanks,
Tamara
- The topic ‘Multiple sidebars – showing up in widget area but not on live site’ is closed to new replies.