__('Sidebar', 'bloglex'), 'id' => 'general-sidebar', 'description' => 'Add global sidebar widgets here.', ); $sidebar_args['after_header'] = array( 'name' => __('After Header', 'bloglex'), 'id' => 'after-header', 'description' => __('Widgets placed in this region will be displayed below the header and above the main content.', 'bloglex'), ); $sidebar_args['homepage_fullwidth_top'] = array( 'name' => __('Homepage Fullwidth Widget Area - Top Area', 'bloglex'), 'id' => 'homepage-fullwidth-top', 'description' => __('Widgets placed in this region will be displayed at the top of homepage layouts, above the two-column widget area.', 'bloglex'), ); $sidebar_args['homepage_column_one'] = array( 'name' => __('Homepage Two Column Widget Area - Primary', 'bloglex'), 'id' => 'homepage-column-one', 'description' => __('Widgets placed in this region will be displayed as the primary area in the two-column, side-by-side homepage widget section.', 'bloglex'), ); $sidebar_args['homepage_column_two'] = array( 'name' => __('Homepage Two Column Widget Area - Secondary', 'bloglex'), 'id' => 'homepage-column-two', 'description' => __('Widgets placed in this region will be displayed as the secondary area in the two-column, side-by-side homepage widget section.', 'bloglex'), ); $sidebar_args['homepage_before_posts'] = array( 'name' => __('Homepage Before Posts', 'bloglex'), 'id' => 'homepage-before-posts', 'description' => __('Widgets added to this region will appear on the homepage before posts listing.', 'bloglex'), ); $sidebar_args['homepage_after_posts'] = array( 'name' => __('Homepage After Posts', 'bloglex'), 'id' => 'homepage-after-posts', 'description' => __('Widgets added to this region will appear on the homepage after posts listing.', 'bloglex'), ); $sidebar_args['homepage_fullwidth_bottom'] = array( 'name' => __('Homepage Fullwidth Widget Area - Bottom Area', 'bloglex'), 'id' => 'homepage-fullwidth-bottom', 'description' => __('Widgets placed in this region will be displayed right after the two-column widget area.', 'bloglex'), ); $sidebar_args['before_footer'] = array( 'name' => __('Before Footer', 'bloglex'), 'id' => 'before-footer-widgetarea', 'description' => __('Widgets added to this region will appear above the footer.', 'bloglex'), ); $footer_column = 4; $footer_column_layout = bloglex_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('bloglex_footer_widget_columns', $footer_column)); for ($j = 1; $j <= $cols; $j++) { $footer = sprintf('footer_%d', $j); $footer_region_name = sprintf(__('Footer Column %1$d', 'bloglex'), $j); $footer_region_description = sprintf(__('Widgets added here will appear in column %1$d of the footer.', 'bloglex'), $j); $sidebar_args[$footer] = array( 'name' => $footer_region_name, 'id' => sprintf('footer-%d', $j), 'description' => $footer_region_description, ); } $sidebar_args['after_footer'] = array( 'name' => __('After Footer', 'bloglex'), 'id' => 'after-footer-widgetarea', 'description' => __('Widgets added to this region will appear after the footer and before sub-footer.', 'bloglex'), ); if ( bloglex_is_wc_active() ) { $sidebar_args['wc_sidebar'] = array( 'name' => __( 'WooCommerce Shop/Category Page Sidebar', 'bloglex' ), 'id' => 'wc-sidebar', 'description' => __( 'Widgets added to this region will appear on the shop or category page of woocommerce.', 'bloglex' ), ); $sidebar_args['wc_product_single_sidebar'] = array( 'name' => __( 'WooCommerce Product Page Sidebar', 'bloglex' ), 'id' => 'wc-product-single-sidebar', 'description' => __( 'Widgets added to this region will appear on detail page of a woocommerce product.', 'bloglex' ), ); } $sidebar_args = apply_filters('bloglex_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. . $filter_hook = sprintf('bloglex_%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', 'bloglex_widgets_init');