Make WordPress Core


Ignore:
Timestamp:
08/20/2013 05:52:22 PM (12 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: change to just one footer widget area and use Masonry JS to display the widgets in columns. Props Frank Klein, closes #24874.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r25064 r25065  
    143143    ) );
    144144    register_sidebar( array(
    145         'name' => __( 'Footer Widget Area One', 'twentyfourteen' ),
     145        'name' => __( 'Footer Widget Area', 'twentyfourteen' ),
    146146        'id' => 'sidebar-3',
    147147        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
     
    150150        'after_title' => '</h1>',
    151151    ) );
    152     register_sidebar( array(
    153         'name' => __( 'Footer Widget Area Two', 'twentyfourteen' ),
    154         'id' => 'sidebar-4',
    155         'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    156         'after_widget' => '</aside>',
    157         'before_title' => '<h1 class="widget-title">',
    158         'after_title' => '</h1>',
    159     ) );
    160     register_sidebar( array(
    161         'name' => __( 'Footer Widget Area Three', 'twentyfourteen' ),
    162         'id' => 'sidebar-5',
    163         'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    164         'after_widget' => '</aside>',
    165         'before_title' => '<h1 class="widget-title">',
    166         'after_title' => '</h1>',
    167     ) );
    168     register_sidebar( array(
    169         'name' => __( 'Footer Widget Area Four', 'twentyfourteen' ),
    170         'id' => 'sidebar-6',
    171         'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    172         'after_widget' => '</aside>',
    173         'before_title' => '<h1 class="widget-title">',
    174         'after_title' => '</h1>',
    175     ) );
    176     register_sidebar( array(
    177         'name' => __( 'Footer Widget Area Five', 'twentyfourteen' ),
    178         'id' => 'sidebar-7',
    179         'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    180         'after_widget' => '</aside>',
    181         'before_title' => '<h1 class="widget-title">',
    182         'after_title' => '</h1>',
    183     ) );
    184152}
    185153add_action( 'widgets_init', 'twentyfourteen_widgets_init' );
     
    213181    if ( is_singular() && wp_attachment_is_image() )
    214182        wp_enqueue_script( 'twentyfourteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20130402' );
     183
     184    if ( is_active_sidebar( 'sidebar-3' ) )
     185        wp_enqueue_script( 'jquery-masonry' );
    215186
    216187    wp_enqueue_script( 'twentyfourteen-theme', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20130820', true );
     
    332303
    333304/**
    334  * Count the number of footer sidebars to enable dynamic classes for the footer
    335  *
    336  */
    337 function twentyfourteen_footer_sidebar_class() {
    338     $count = 0;
    339 
    340     if ( is_active_sidebar( 'sidebar-3' ) )
    341         $count++;
    342 
    343     if ( is_active_sidebar( 'sidebar-4' ) )
    344         $count++;
    345 
    346     if ( is_active_sidebar( 'sidebar-5' ) )
    347         $count++;
    348 
    349     if ( is_active_sidebar( 'sidebar-6' ) )
    350         $count++;
    351 
    352     if ( is_active_sidebar( 'sidebar-7' ) )
    353         $count++;
    354 
    355     $class = '';
    356 
    357     switch ( $count ) {
    358         case '1':
    359             $class = 'one';
    360             break;
    361         case '2':
    362             $class = 'two';
    363             break;
    364         case '3':
    365             $class = 'three';
    366             break;
    367         case '4':
    368             $class = 'four';
    369             break;
    370         case '5':
    371             $class = 'five';
    372             break;
    373     }
    374 
    375     if ( $class )
    376         printf( 'class="%s"', $class );
    377 }
    378 
    379 /**
    380305 * Gets recent formatted posts that are not featured in FC plugin.
    381306 *
Note: See TracChangeset for help on using the changeset viewer.