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
This commit is contained in:
parent
7e7750fd52
commit
9cadeb70ca
@ -216,20 +216,6 @@ function twentytwelve_widgets_init() {
|
|||||||
}
|
}
|
||||||
add_action( 'widgets_init', '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' ) ) :
|
if ( ! function_exists( 'twentytwelve_content_nav' ) ) :
|
||||||
/**
|
/**
|
||||||
* Displays navigation to next/previous pages when applicable.
|
* Displays navigation to next/previous pages when applicable.
|
||||||
@ -364,8 +350,11 @@ endif;
|
|||||||
* Extends the default WordPress body class to denote:
|
* Extends the default WordPress body class to denote:
|
||||||
* 1. Using a full-width layout, when no active widgets in the sidebar
|
* 1. Using a full-width layout, when no active widgets in the sidebar
|
||||||
* or full-width template.
|
* 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.
|
* 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
|
* @since Twenty Twelve 1.0
|
||||||
*
|
*
|
||||||
@ -382,6 +371,8 @@ function twentytwelve_body_class( $classes ) {
|
|||||||
$classes[] = 'template-front-page';
|
$classes[] = 'template-front-page';
|
||||||
if ( has_post_thumbnail() )
|
if ( has_post_thumbnail() )
|
||||||
$classes[] = '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 ) )
|
if ( empty( $background_color ) )
|
||||||
|
@ -199,14 +199,14 @@ label ~ span.required {
|
|||||||
margin: 8px 0 8px 24px;
|
margin: 8px 0 8px 24px;
|
||||||
}
|
}
|
||||||
.template-front-page .widget-area .widget,
|
.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;
|
float: right;
|
||||||
}
|
}
|
||||||
.template-front-page .widget-area .widget:nth-child(odd) {
|
.template-front-page .widget-area .widget:nth-child(odd) {
|
||||||
clear: left;
|
clear: left;
|
||||||
}
|
}
|
||||||
.template-front-page .widget-area .widget:nth-child(even),
|
.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;
|
float: left;
|
||||||
margin: 0 24px 0;
|
margin: 0 24px 0;
|
||||||
margin: 0 1.714285714rem 0;
|
margin: 0 1.714285714rem 0;
|
||||||
|
@ -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.
|
// 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' ) ) : ?>
|
<?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
|
||||||
<div class="first front-widgets">
|
<div class="first front-widgets">
|
||||||
<?php dynamic_sidebar( 'sidebar-2' ); ?>
|
<?php dynamic_sidebar( 'sidebar-2' ); ?>
|
||||||
|
@ -1474,7 +1474,7 @@ img#wpstats {
|
|||||||
width: 47.916666667%;
|
width: 47.916666667%;
|
||||||
}
|
}
|
||||||
.template-front-page .widget-area .widget,
|
.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;
|
float: left;
|
||||||
width: 51.875%;
|
width: 51.875%;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
@ -1484,14 +1484,14 @@ img#wpstats {
|
|||||||
clear: right;
|
clear: right;
|
||||||
}
|
}
|
||||||
.template-front-page .widget-area .widget:nth-child(even),
|
.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;
|
float: right;
|
||||||
width: 39.0625%;
|
width: 39.0625%;
|
||||||
margin: 0 0 24px;
|
margin: 0 0 24px;
|
||||||
margin: 0 0 1.714285714rem;
|
margin: 0 0 1.714285714rem;
|
||||||
}
|
}
|
||||||
.template-front-page .widget-area.two .widget,
|
.template-front-page.two-sidebars .widget,
|
||||||
.template-front-page .widget-area.two .widget:nth-child(even) {
|
.template-front-page.two-sidebars .widget:nth-child(even) {
|
||||||
float: none;
|
float: none;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user