Last active
March 14, 2017 08:12
-
-
Save anegoda1995/6d0a731cafb7883ab113e95c12e91d1a to your computer and use it in GitHub Desktop.
Register widget area (sidebar) in WordPress template functions.php file
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 [name_of_theme]_widgets_init() | |
{ | |
register_sidebar(array( | |
'name' => esc_html__('Name of widget area', '[name_of_theme]'), | |
'id' => '[widget_area_unique_name]', //OnLy LoWeRcAsE!!!!!!!!!!!!!!!!!! else not save widgets on area | |
'description' => esc_html__('Description', '[name_of_theme]'), | |
'before_widget' => '<section id="%1$s" class="widget %2$s">', | |
'after_widget' => '</section>', | |
'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