Last active
March 4, 2020 15:06
-
-
Save BinaryMoon/d9bb63283067a129170871a133dae206 to your computer and use it in GitHub Desktop.
Register WordPress sidebars demo
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 | |
/** | |
* Intitiate sidebars | |
* | |
* @link https://developer.wordpress.org/reference/functions/register_sidebar/ | |
*/ | |
function mytheme_widgets_init() { | |
// Sidebar. | |
register_sidebar( | |
array( | |
'name' => esc_html__( 'Sidebar Main', 'mytheme' ), | |
'id' => 'sidebar-1', | |
'description' => esc_html__( 'Widgets that display on the side of your website', 'mytheme' ), | |
'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-wrap">', | |
'after_widget' => '</div></section>', | |
'before_title' => '<h2 class="widget-title">', | |
'after_title' => '</h2>', | |
) | |
); | |
} | |
add_action( 'widgets_init', 'mytheme_widgets_init' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment