Ticket #21619: 21619.diff

File 21619.diff, 3.8 KB (added by obenland, 9 months ago)
  • wp-content/themes/twentytwelve/style.css

     
    14351435                float: right; 
    14361436                width: 47.916666667%; 
    14371437        } 
    1438         .page-template-homepage-php .widget-area .widget { 
     1438        .page-template-homepage-php .widget-area.two .home-widgets { 
    14391439                float: left; 
    14401440                width: 51.875%; 
    14411441                margin-bottom: 24px; 
    14421442                margin-bottom: 1.714285714rem; 
    14431443        } 
    1444         .page-template-homepage-php .widget-area .widget:nth-child(even) { 
     1444        .page-template-homepage-php .widget-area.two .home-widgets + .home-widgets { 
    14451445                float: right; 
    14461446                width: 39.0625%; 
    14471447                margin: 0 0 24px; 
  • wp-content/themes/twentytwelve/functions.php

     
    191191        ) ); 
    192192 
    193193        register_sidebar( array( 
    194                 'name' => __( 'Homepage Widgets', 'twentytwelve' ), 
    195                 'id' => 'sidebar-home', 
     194                'name' => __( 'Homepage Widgets One', 'twentytwelve' ), 
     195                'id' => 'sidebar-2', 
     196                'description' => __( 'Appears when using the optional homepage template with a page set as Static Front Page', 'twentytwelve' ), 
     197                'before_widget' => '<aside id="%1$s" class="widget %2$s">', 
     198                'after_widget' => '</aside>', 
     199                'before_title' => '<h3 class="widget-title">', 
     200                'after_title' => '</h3>', 
     201        ) ); 
     202         
     203        register_sidebar( array( 
     204                'name' => __( 'Homepage Widgets Two', 'twentytwelve' ), 
     205                'id' => 'sidebar-3', 
    196206                'description' => __( 'Appears when using the optional homepage template with a page set as Static Front Page', 'twentytwelve' ), 
    197207                'before_widget' => '<aside id="%1$s" class="widget %2$s">', 
    198208                'after_widget' => '</aside>', 
     
    202212} 
    203213add_action( 'widgets_init', 'twentytwelve_widgets_init' ); 
    204214 
     215/** 
     216 * Count the number of footer sidebars to enable dynamic classes for the footer 
     217 *  
     218 * @since Twenty Twelve 1.0 
     219 */ 
     220function twentytwelve_homepage_sidebar_class() { 
     221        $classes = array( 'widget-area' ); 
     222 
     223        if ( is_active_sidebar( 2 ) && is_active_sidebar( 3 ) ) 
     224                $classes[] = 'two'; 
     225 
     226        echo 'class="' . implode( ' ', $classes ) . '"'; 
     227} 
     228 
    205229if ( ! function_exists( 'twentytwelve_content_nav' ) ) : 
    206230/** 
    207231 * Display navigation to next/previous pages when applicable. 
  • wp-content/themes/twentytwelve/sidebar-home.php

     
    88 * @subpackage Twenty_Twelve 
    99 * @since Twenty Twelve 1.0 
    1010 */ 
     11 
     12/* The homepage widget area is triggered if any of the areas 
     13 * have widgets. So let's check that first. 
     14 * 
     15 * If none of the sidebars have widgets, then let's bail early. 
     16 */ 
     17if ( ! is_active_sidebar( 2 ) && ! is_active_sidebar( 3 ) ) 
     18        return; 
     19 
     20// If we get this far, we have widgets. Let do this. 
    1121?> 
     22<div id="secondary" <?php twentytwelve_homepage_sidebar_class(); ?> role="complementary"> 
     23        <?php if ( is_active_sidebar( 2 ) ) : ?> 
     24        <div class="first home-widgets"> 
     25                <?php dynamic_sidebar( 'sidebar-2' ); ?> 
     26        </div><!-- .first .home-widgets --> 
     27        <?php endif; ?> 
    1228 
    13         <?php if ( is_active_sidebar( 'sidebar-home' ) ) : ?> 
    14                 <div id="secondary" class="widget-area" role="complementary"> 
    15                         <?php dynamic_sidebar( 'sidebar-home' ); ?> 
    16                 </div><!-- #secondary .widget-area --> 
    17         <?php endif; ?> 
    18  No newline at end of file 
     29        <?php if ( is_active_sidebar( 3 ) ) : ?> 
     30        <div class="second home-widgets"> 
     31                <?php dynamic_sidebar( 'sidebar-3' ); ?> 
     32        </div><!-- .second .home-widgets --> 
     33        <?php endif; ?> 
     34</div><!-- #secondary .widget-area --> 
     35 No newline at end of file