Skip to content

Instantly share code, notes, and snippets.

@szbl
Created November 6, 2013 21:11
Show Gist options
  • Save szbl/7344155 to your computer and use it in GitHub Desktop.
Save szbl/7344155 to your computer and use it in GitHub Desktop.
<?php
/*
Quickly register lots of sidebars with similar/default code.
*/
$defaults = array(
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
);
$sidebars = array(
array(
'id' => 'footer-1',
'name' => __( 'Footer 1' ),
'description' => __( 'Shows in Footer Slot 1' )
),
array(
'id' => 'footer-2',
'name' => __( 'Footer 2' ),
'description' => __( 'Shows in Footer Slot 2' )
),
array(
'id' => 'footer-3',
'name' => __( 'Footer 3' ),
'description' => __( 'Shows in Footer Slot 3' ),
'before_title' => '<h4 class="widget-title example-override">',
'after_title' => '</h4>'
),
);
// register all sidebars with defaults
foreach ( $sidebars as $sidebar )
{
register_sidebar( array_merge( $defaults, $sidebar ) );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment