Skip to content

Instantly share code, notes, and snippets.

@Jehu
Created May 1, 2021 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jehu/217fbd8e5761d03ff694b0c2cf07d47b to your computer and use it in GitHub Desktop.
Save Jehu/217fbd8e5761d03ff694b0c2cf07d47b to your computer and use it in GitHub Desktop.
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