From 9cadeb70ca3f6d5fd2876a4ba914e43bc55ab9b3 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: https://develop.svn.wordpress.org/trunk@21975 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-content/themes/twentytwelve/functions.php | 21 ++++++------------- wp-content/themes/twentytwelve/rtl.css | 4 ++-- .../themes/twentytwelve/sidebar-front.php | 2 +- wp-content/themes/twentytwelve/style.css | 8 +++---- 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/wp-content/themes/twentytwelve/functions.php b/wp-content/themes/twentytwelve/functions.php index e399343ee0..7fd67d801b 100644 --- a/wp-content/themes/twentytwelve/functions.php +++ b/wp-content/themes/twentytwelve/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/wp-content/themes/twentytwelve/rtl.css b/wp-content/themes/twentytwelve/rtl.css index 0a89694494..97fc67a850 100644 --- a/wp-content/themes/twentytwelve/rtl.css +++ b/wp-content/themes/twentytwelve/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/wp-content/themes/twentytwelve/sidebar-front.php b/wp-content/themes/twentytwelve/sidebar-front.php index 0ae5ed4a11..4dfa140372 100644 --- a/wp-content/themes/twentytwelve/sidebar-front.php +++ b/wp-content/themes/twentytwelve/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"> +