Make WordPress Core

Changeset 38083


Ignore:
Timestamp:
07/17/2016 09:13:35 PM (9 years ago)
Author:
westonruter
Message:

Twenty Thirteen: Fix selective refresh of Masonry-laid out widgets by deferring initialization until DOM ready.

This ensures that the wp.customize.selectiveRefresh object will be available when in the Customizer preview.

Fixes #37390.
Props westonruter, celloexpressions.

Location:
trunk/src/wp-content/themes/twentythirteen
Files:
2 edited

Legend:

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

    r38026 r38083  
    174174
    175175    // Loads JavaScript file with functionality specific to Twenty Thirteen.
    176     wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true );
     176    wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20160717', true );
    177177
    178178    // Add Source Sans Pro and Bitter fonts, used in the main stylesheet.
  • trunk/src/wp-content/themes/twentythirteen/js/functions.js

    r37040 r38083  
    120120     * Arranges footer widgets vertically.
    121121     */
    122     if ( $.isFunction( $.fn.masonry ) ) {
    123         var columnWidth = body.is( '.sidebar' ) ? 228 : 245,
    124             widgetArea = $( '#secondary .widget-area' );
     122    $( function() {
     123        var columnWidth, widgetArea;
     124        if ( ! $.isFunction( $.fn.masonry ) ) {
     125            return;
     126        }
     127        columnWidth = body.is( '.sidebar' ) ? 228 : 245;
     128        widgetArea = $( '#secondary .widget-area' );
    125129
    126130        widgetArea.masonry( {
     
    158162            } );
    159163        }
    160     }
     164    } );
    161165} )( jQuery );
Note: See TracChangeset for help on using the changeset viewer.