Created
November 25, 2015 08:31
-
-
Save talentedaamer/68bccfe45eae395cd9c9 to your computer and use it in GitHub Desktop.
Register widget areas or sidebars in WordPress using register_sidebar() function
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 | |
/** | |
* widgets_init action hook. | |
* used to register, widgets or widget areas in a theme. | |
*/ | |
add_action( 'widgets_init', 'oopthemes_widgets_init' ); | |
function oopthemes_widgets_init() { | |
register_sidebar( array( | |
'name' => __( 'Primary Sidebar', 'theme-slug' ), | |
'id' => 'sidebar-primary', | |
'description' => __( 'Description of the Primary sidebar.', 'theme-slug' ), | |
'before_widget' => '<aside id="%1$s" class="primary-widget widget %2$s">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h2 class="widget-title">', | |
'after_title' => '</h2>', | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment