Register sidebar

This commit is contained in:
ernilambar 2018-09-05 17:44:02 +05:45
parent f955b80080
commit 2018407cdb

View file

@ -67,3 +67,22 @@ if ( true === $enable_image_upscale ) {
add_filter( 'image_resize_dimensions', 'alx_ext_thumbnail_upscale', 10, 6 );
}
function alx_ext_register_custom_sidebars() {
if ( !get_theme_mod('sidebar-areas') =='' ) {
$sidebars = get_theme_mod('sidebar-areas', array());
if ( !empty( $sidebars ) ) {
foreach( $sidebars as $sidebar ) {
if ( isset($sidebar['title']) && !empty($sidebar['title']) && isset($sidebar['id']) && !empty($sidebar['id']) && ($sidebar['id'] !='sidebar-') ) {
register_sidebar(array('name' => ''.esc_attr( $sidebar['title'] ).'','id' => ''.esc_attr( strtolower($sidebar['id']) ).'','before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3 class="group"><span>','after_title' => '</span></h3>'));
}
}
}
}
}
add_action( 'widgets_init', 'alx_ext_register_custom_sidebars', 11 );