Sidebar Generator
Widget areas with the wrapper markup your theme actually needs — placeholders intact, tags closed, and the template call that renders them.
Widget areas
Sidebarsidebar-1
Footer 1footer-1
Footer 2footer-2
Wrapper markup
sprintf()-ed with the widget id and class.
Must close everything before_widget opened.
Wraps the widget title. h2 is the accessible default.
Closes the title tag.
One set of markup for every area
Off lets each area carry its own wrappers — useful when the footer columns and the main sidebar look nothing alike.
Naming & shape
Shape
Template output
is_active_sidebar() guard
Fallback content
get_sidebar() note
// Generated with WP CodeKit — powered by GrowQuest (https://growquest.io). /** * Register the theme’s widget areas. */ function mytheme_widget_areas() { $defaults = array( 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ); $areas = array( array( 'id' => 'sidebar-1', 'name' => __( 'Sidebar', 'mytheme' ), 'description' => __( 'The main sidebar on posts and pages.', 'mytheme' ), ), array( 'id' => 'footer-1', 'name' => __( 'Footer 1', 'mytheme' ), 'description' => __( 'First footer column.', 'mytheme' ), ), array( 'id' => 'footer-2', 'name' => __( 'Footer 2', 'mytheme' ), 'description' => __( 'Second footer column.', 'mytheme' ), ), ); foreach ( $areas as $area ) { register_sidebar( array_merge( $defaults, $area ) ); } } add_action( 'widgets_init', 'mytheme_widget_areas' );