__( 'Sidebar', 'blogcorner' ), 'id' => 'sidebar-1', 'description' => __( 'The sidebar will display any widgets that are added to this region.', 'blogcorner' ), ); $sidebar_args['offcanvas_sidebar'] = array( 'name' => __( 'Offcanvas Widgets', 'blogcorner' ), 'id' => 'blogcorner-offcanvas-widget', 'description' => __( 'Any widgets that are placed in this area will be displayed on the offcanvas sidebar.', 'blogcorner' ), ); $sidebar_args['homepage_top_widget'] = array( 'name' => __( 'Widgets before Customizer Sections on the Homepage', 'blogcorner' ), 'id' => 'blogcorner-homepage-top-widget', 'description' => __( 'Any widgets that are placed in this area will be displayed on the Top section of Homepage.', 'blogcorner' ), 'class' => '', 'before_widget' => '
', 'after_widget' => "
", ); $sidebar_args['homepage_bottom_widget'] = array( 'name' => __( 'Widgets after Customizer Sections on the Homepage', 'blogcorner' ), 'id' => 'blogcorner-homepage-bottom-widget', 'description' => __( 'Any widgets that are placed in this area will be displayed on the Top section of Homepage.', 'blogcorner' ), 'class' => '', 'before_widget' => '
', 'after_widget' => "
", ); /*Get homepage sidebar option from the customizer*/ $sidebar_args['above_footer'] = array( 'name' => __( 'Footer Fullwidth', 'blogcorner' ), 'id' => 'fullwidth-footer-widgetarea', 'description' => __( 'Widgets added to this region will appear above the footer.', 'blogcorner' ), 'before_widget' => '
', 'after_widget' => "
", ); /*Get the footer column from the customizer*/ $footer_column_layout = blogcorner_get_option('footer_column_layout'); if($footer_column_layout){ switch ($footer_column_layout) { case "footer_layout_1": $footer_column = 4; break; case "footer_layout_2": case "footer_layout_5": $footer_column = 3; break; case "footer_layout_3": case "footer_layout_4": case "footer_layout_6": $footer_column = 2; break; default: $footer_column = 4; } }else{ $footer_column = 4; } $cols = intval( apply_filters( 'blogcorner_footer_widget_columns', $footer_column ) ); for ( $j = 1; $j <= $cols; $j++ ) { $footer = sprintf( 'footer_%d', $j ); $footer_region_name = sprintf( __( 'Footer Column %1$d', 'blogcorner' ), $j ); $footer_region_description = sprintf( __( 'Widgets added here will appear in column %1$d of the footer.', 'blogcorner' ), $j ); $sidebar_args[ $footer ] = array( 'name' => $footer_region_name, 'id' => sprintf( 'footer-%d', $j ), 'description' => $footer_region_description, ); } $sidebar_args = apply_filters( 'blogcorner_sidebar_args', $sidebar_args ); foreach ( $sidebar_args as $sidebar => $args ) { $widget_tags = array( 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ); /** * Dynamically generated filter hooks. Allow changing widget wrapper and title tags. See example below. */ $filter_hook = sprintf( 'blogcorner_%s_widget_tags', $sidebar ); $widget_tags = apply_filters( $filter_hook, $widget_tags ); if ( is_array( $widget_tags ) ) { register_sidebar( $args + $widget_tags ); } } } add_action( 'widgets_init', 'blogcorner_widgets_init' );