Created
August 3, 2018 16:30
-
-
Save Edwardtonnn/4c8f37a827dd5a5726c7bb410feeeb3c to your computer and use it in GitHub Desktop.
Adds multiple sidebars to any theme for 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
<?php | |
// Adds Widget Area | |
// Register Widgets | |
function custom_sidebar() { | |
register_sidebar(array( | |
'id' => 'my-new-widget', | |
'name' => __( 'My New Widget', 'text_domain' ), | |
'description' => __( 'This is my widget description.', 'text_domain' ), | |
'before_title' => '<h3 class="widget-title">', | |
'after_title' => '</h3>', | |
'before_widget' => '<section id="%1$s" class="widget %2$s">', | |
'after_widget' => '</section>', | |
)); | |
register_sidebar(array( | |
'id' => 'my-new-widget-2', | |
'name' => __( 'My New Widget 2', 'text_domain' ), | |
'description' => __( 'This is my widget description.', 'text_domain' ), | |
'before_title' => '<h3 class="widget-title">', | |
'after_title' => '</h3>', | |
'before_widget' => '<section id="%1$s" class="widget %2$s">', | |
'after_widget' => '</section>', | |
)); | |
} | |
add_action( 'widgets_init', 'custom_sidebar' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment