Skip to content
Browse files

Twenty Twelve: use sidebar ID string value for sidebar checks instead…

… of hard-coded integer, props nacin. See #21685.

git-svn-id: http://core.svn.wordpress.org/trunk@21643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 3922fe7 commit 860286457790026626f6f4667fc877230ee8d061 @nanobar nanobar committed Aug 28, 2012
View
6 wp-content/themes/twentytwelve/functions.php
@@ -211,7 +211,7 @@ function twentytwelve_widgets_init() {
function twentytwelve_homepage_sidebar_class() {
$classes = array( 'widget-area' );
- if ( is_active_sidebar( 2 ) && is_active_sidebar( 3 ) )
+ if ( is_active_sidebar( 'sidebar-2' ) && is_active_sidebar( 'sidebar-3' ) )
$classes[] = 'two';
echo 'class="' . implode( ' ', $classes ) . '"';
@@ -362,7 +362,7 @@ function twentytwelve_entry_meta() {
function twentytwelve_body_class( $classes ) {
$background_color = get_background_color();
- if ( ! is_active_sidebar( 1 ) || is_page_template( 'page-templates/full-width.php' ) )
+ if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'page-templates/full-width.php' ) )
$classes[] = 'full-width';
if ( is_page_template( 'page-templates/home.php' ) ) {
@@ -387,7 +387,7 @@ function twentytwelve_body_class( $classes ) {
* @since Twenty Twelve 1.0
*/
function twentytwelve_content_width() {
- if ( is_page_template( 'page-templates/full-width.php' ) || is_attachment() || ! is_active_sidebar( 1 ) ) {
+ if ( is_page_template( 'page-templates/full-width.php' ) || is_attachment() || ! is_active_sidebar( 'sidebar-1' ) ) {
global $content_width;
$content_width = 960;
}
View
10 wp-content/themes/twentytwelve/sidebar-home.php
@@ -15,21 +15,21 @@
*
* If none of the sidebars have widgets, then let's bail early.
*/
-if ( ! is_active_sidebar( 2 ) && ! is_active_sidebar( 3 ) )
+if ( ! is_active_sidebar( 'sidebar-2' ) && ! is_active_sidebar( 'sidebar-3' ) )
return;
// If we get this far, we have widgets. Let do this.
?>
<div id="secondary" <?php twentytwelve_homepage_sidebar_class(); ?> role="complementary">
- <?php if ( is_active_sidebar( 2 ) ) : ?>
+ <?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
<div class="first home-widgets">
- <?php dynamic_sidebar( 2 ); ?>
+ <?php dynamic_sidebar( 'sidebar-2' ); ?>
</div><!-- .first -->
<?php endif; ?>
- <?php if ( is_active_sidebar( 3 ) ) : ?>
+ <?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?>
<div class="second home-widgets">
- <?php dynamic_sidebar( 3 ); ?>
+ <?php dynamic_sidebar( 'sidebar-3' ); ?>
</div><!-- .second -->
<?php endif; ?>
</div><!-- #secondary -->
View
4 wp-content/themes/twentytwelve/sidebar.php
@@ -10,8 +10,8 @@
*/
?>
- <?php if ( is_active_sidebar( 1 ) ) : ?>
+ <?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<div id="secondary" class="widget-area" role="complementary">
- <?php dynamic_sidebar( 1 ); ?>
+ <?php dynamic_sidebar( 'sidebar-1' ); ?>
</div><!-- #secondary -->
<?php endif; ?>

0 comments on commit 8602864

Please sign in to comment.
Something went wrong with that request. Please try again.