Skip to content

Instantly share code, notes, and snippets.

@davemac
Last active August 29, 2015 14:08
Show Gist options
  • Save davemac/fe8f93e2c302071ee290 to your computer and use it in GitHub Desktop.
Save davemac/fe8f93e2c302071ee290 to your computer and use it in GitHub Desktop.
WP Sidebars
add_action( 'widgets_init', 'dmc_register_sidebars' );
function dmc_register_sidebars() {
register_sidebar(array(
'name'=> 'Conferences Sidebar',
'id' => 'sidebar-conferences',
'description' => 'Widgets placed here will appear in the sidebar on the Conferences pages',
'before_widget' => '<article id="%1$s" class="panel widget %2$s">',
'after_widget' => '</article>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
register_sidebar(array(
'name'=> 'Single Conference Sidebar',
'id' => 'sidebar-conferences-single',
'description' => 'Widgets placed here will appear in the sidebar on single Conference pages',
'before_widget' => '<article id="%1$s" class="panel widget %2$s">',
'after_widget' => '</article>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
register_sidebar(array(
'name'=> 'Single Speaker Sidebar',
'id' => 'sidebar-speaker-single',
'description' => 'Widgets placed here will appear in the sidebar on single Speaker pages',
'before_widget' => '<article id="%1$s" class="panel widget %2$s">',
'after_widget' => '</article>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
register_sidebar(array(
'name'=> 'About Sidebar',
'id' => 'sidebar-about',
'description' => 'Widgets placed here will appear in the sidebar on the About pages',
'before_widget' => '<article id="%1$s" class="panel widget %2$s">',
'after_widget' => '</article>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
register_sidebar(array(
'name'=> 'Contact Us Sidebar',
'id' => 'sidebar-contact',
'description' => 'Widgets placed here will appear in the sidebar on the Contact page',
'before_widget' => '<article id="%1$s" class="panel widget %2$s">',
'after_widget' => '</article>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
register_sidebar(array(
'name'=> 'Footer Area',
'id' => 'sidebar-footer',
'description' => 'Widgets placed here will appear in the footer on every page',
'before_widget' => '<div class="large-8 columns"><article id="%1$s" class="panel widget %2$s">',
'after_widget' => '</div></article>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment