From 339b82058b2f4509e5da02e3b062126fe3e3f297 Mon Sep 17 00:00:00 2001 From: Lance Willett Date: Mon, 24 Sep 2012 16:57:42 +0000 Subject: [PATCH] Twenty Twelve: remove `twentytwelve_frontpage_sidebar_class()` and make front page sidebar number filterable via `body_class`. Fixes #21942. git-svn-id: http://core.svn.wordpress.org/trunk@21975 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- functions.php | 21 ++++++--------------- rtl.css | 4 ++-- sidebar-front.php | 2 +- style.css | 8 ++++---- 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/functions.php b/functions.php index e399343ee..7fd67d801 100644 --- a/functions.php +++ b/functions.php @@ -216,20 +216,6 @@ function twentytwelve_widgets_init() { } add_action( 'widgets_init', 'twentytwelve_widgets_init' ); -/** - * Counts the number of footer sidebars to enable dynamic classes for the footer. - * - * @since Twenty Twelve 1.0 - */ -function twentytwelve_frontpage_sidebar_class() { - $classes = array( 'widget-area' ); - - if ( is_active_sidebar( 'sidebar-2' ) && is_active_sidebar( 'sidebar-3' ) ) - $classes[] = 'two'; - - echo 'class="' . implode( ' ', $classes ) . '"'; -} - if ( ! function_exists( 'twentytwelve_content_nav' ) ) : /** * Displays navigation to next/previous pages when applicable. @@ -364,8 +350,11 @@ endif; * Extends the default WordPress body class to denote: * 1. Using a full-width layout, when no active widgets in the sidebar * or full-width template. - * 2. A thumbnail in the Front Page template. + * 2. Front Page template: thumbnail in use and number of sidebars for + * widget areas. * 3. White or empty background color to change the layout and spacing. + * 4. Custom fonts enabled. + * 5. Single or multiple authors. * * @since Twenty Twelve 1.0 * @@ -382,6 +371,8 @@ function twentytwelve_body_class( $classes ) { $classes[] = 'template-front-page'; if ( has_post_thumbnail() ) $classes[] = 'has-post-thumbnail'; + if ( is_active_sidebar( 'sidebar-2' ) && is_active_sidebar( 'sidebar-3' ) ) + $classes[] = 'two-sidebars'; } if ( empty( $background_color ) ) diff --git a/rtl.css b/rtl.css index 0a8969449..97fc67a85 100644 --- a/rtl.css +++ b/rtl.css @@ -199,14 +199,14 @@ label ~ span.required { margin: 8px 0 8px 24px; } .template-front-page .widget-area .widget, - .template-front-page .widget-area.two .front-widgets { + .template-front-page.two-sidebars .widget-area .front-widgets { float: right; } .template-front-page .widget-area .widget:nth-child(odd) { clear: left; } .template-front-page .widget-area .widget:nth-child(even), - .template-front-page .widget-area.two .front-widgets + .front-widgets { + .template-front-page.two-sidebars .widget-area .front-widgets + .front-widgets { float: left; margin: 0 24px 0; margin: 0 1.714285714rem 0; diff --git a/sidebar-front.php b/sidebar-front.php index 0ae5ed4a1..4dfa14037 100644 --- a/sidebar-front.php +++ b/sidebar-front.php @@ -20,7 +20,7 @@ if ( ! is_active_sidebar( 'sidebar-2' ) && ! is_active_sidebar( 'sidebar-3' ) ) // If we get this far, we have widgets. Let do this. ?> -
role="complementary"> +