__( 'Sidebar', 'blog-tale' ), 'id' => 'sidebar-1', 'description' => '' ); $sidebar_args['below_header'] = array( 'name' => __( 'Below Header', 'blog-tale' ), 'id' => 'below-header-widget-area', 'description' => __( 'Widgets added to this region will appear beneath the header and above the main content.', 'blog-tale' ), ); $sidebar_args['above_homepage'] = array( 'name' => __( 'Above Homepage', 'blog-tale' ), 'id' => 'above-homepage-widget-area', 'description' => __( 'Widgets added to this region will appear above the homepage content. Basically useful if you want to have sidebar on homepage but want some content on top without the sidebar too.', 'blog-tale' ), ); $sidebar_args['homepage'] = array( 'name' => __( 'Homepage', 'blog-tale' ), 'id' => 'home-page-widget-area', 'description' => __( 'Widgets added to this region will appear on the homepage.', 'blog-tale' ), ); $sidebar_args['homepage_sidebar'] = array( 'name' => __( 'Homepage Sidebar', 'blog-tale' ), 'id' => 'home-page-sidebar', 'description' => __( 'Widgets added to this region will appear on the homepage sidebar.', 'blog-tale' ), ); $sidebar_args['below_homepage'] = array( 'name' => __( 'Below Homepage', 'blog-tale' ), 'id' => 'below-homepage-widget-area', 'description' => __( 'Widgets added to this region will appear below the homepage content. Basically useful if you want to have sidebar on homepage but want some content on bottom without the sidebar too.', 'blog-tale' ), ); $sidebar_args['above_footer'] = array( 'name' => __( 'Above Footer', 'blog-tale' ), 'id' => 'before-footer-widgetarea', 'description' => __( 'Widgets added to this region will appear above the footer.', 'blog-tale' ), ); $sidebar_args['above_footer_no_container'] = array( 'name' => __( 'Above Footer - No Container', 'blog-tale' ), 'id' => 'before-footer-widgetarea-nc', 'description' => __( 'Same as above footer but does not have its own container.', 'blog-tale' ), ); /*Get the footer column from the customizer*/ $footer_column_layout = blog_tale_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( 'blog_tale_footer_widget_columns', $footer_column ) ); for ( $j = 1; $j <= $cols; $j++ ) { $footer = sprintf( 'footer_%d', $j ); $footer_region_name = sprintf( __( 'Footer Column %1$d', 'blog-tale' ), $j ); $footer_region_description = sprintf( __( 'Widgets added here will appear in column %1$d of the footer.', 'blog-tale' ), $j ); $sidebar_args[ $footer ] = array( 'name' => $footer_region_name, 'id' => sprintf( 'footer-%d', $j ), 'description' => $footer_region_description, ); } $sidebar_args['below_footer'] = array( 'name' => __( 'Below Footer', 'blog-tale' ), 'id' => 'after-footer-widgetarea', 'description' => __( 'Widgets added to this region will appear after the footer and before sub-footer.', 'blog-tale' ), ); $sidebar_args['below_footer_no_container'] = array( 'name' => __( 'Below Footer - No Container', 'blog-tale' ), 'id' => 'after-footer-widgetarea-nc', 'description' => __( 'Same as below footer but does not have its own container.', 'blog-tale' ), ); $sidebar_args = apply_filters( 'blog_tale_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 the list below. * * 'blog_tale_sidebar_widget_tags' * 'blog_tale_below_header_widget_tags' * 'blog_tale_above_homepage_widget_tags' * 'blog_tale_homepage_widget_tags' * 'blog_tale_homepage_sidebar_widget_tags' * 'blog_tale_below_homepage_widget_tags' * 'blog_tale_above_footer_widget_tags' * * 'blog_tale_footer_1_widget_tags' * 'blog_tale_footer_2_widget_tags' * 'blog_tale_footer_3_widget_tags' * 'blog_tale_footer_4_widget_tags' * * 'blog_tale_below_footer_widget_tags' */ $filter_hook = sprintf( 'blog_tale_%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', 'blog_tale_widgets_init' );