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
This commit is contained in:
Lance Willett 2012-09-24 16:57:42 +00:00
parent 1b90f1ef84
commit 339b82058b
4 changed files with 13 additions and 22 deletions

View File

@ -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 ) )

View File

@ -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;

View File

@ -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.
?>
<div id="secondary" <?php twentytwelve_frontpage_sidebar_class(); ?> role="complementary">
<div id="secondary" class="widget-area" role="complementary">
<?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
<div class="first front-widgets">
<?php dynamic_sidebar( 'sidebar-2' ); ?>

View File

@ -1474,7 +1474,7 @@ img#wpstats {
width: 47.916666667%;
}
.template-front-page .widget-area .widget,
.template-front-page .widget-area.two .front-widgets {
.template-front-page.two-sidebars .widget-area .front-widgets {
float: left;
width: 51.875%;
margin-bottom: 24px;
@ -1484,14 +1484,14 @@ img#wpstats {
clear: right;
}
.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: right;
width: 39.0625%;
margin: 0 0 24px;
margin: 0 0 1.714285714rem;
}
.template-front-page .widget-area.two .widget,
.template-front-page .widget-area.two .widget:nth-child(even) {
.template-front-page.two-sidebars .widget,
.template-front-page.two-sidebars .widget:nth-child(even) {
float: none;
width: auto;
}