Created
September 2, 2017 15:40
-
-
Save vivek-kumar-poddar/8b317c54cc6afddac448807ef183aa89 to your computer and use it in GitHub Desktop.
This code snippet will help you to register a new widget in wordpress. For more details please visit: https://wpvkp.com/create-new-widget-area-in-wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Register widget area. | |
* | |
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar | |
*/ | |
function bb_widgets_init() { | |
register_sidebar( array( | |
'name' => esc_html__( 'Sidebar', 'bb' ), | |
'id' => 'sidebar-1', | |
'description' => esc_html__( 'Add widgets here.', 'bb' ), | |
'before_widget' => '<section id="%1$s" class="widget %2$s">', | |
'after_widget' => '</section>', | |
'before_title' => '<h2 class="widget-title">', | |
'after_title' => '</h2>', | |
) ); | |
} | |
add_action( 'widgets_init', 'bb_widgets_init' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment