Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress Custom Sidebar
<?php
/**
* Plugin Name: My Custom Sidebars
*/
/*
* Use this code for creating all sections you need, just add
* as many register_sidebar() functions as you need here.
*/
function my_widgets_init() {
register_sidebar( array(
'name' => __( 'Footer', 'my_plugin' ),
'id' => 'footer',
'description' => __( 'Widgets in the footer of the page.', 'my_plugin' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
) );
register_sidebar( array(
'name' => __( 'Disclaimer Section', 'my_plugin' ),
'id' => 'disclaimer_section',
'description' => __( 'For the quiz disclaimer text.', 'my_plugin' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'my_widgets_init' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment