⚡ NEW: Changeset/ - Uncensored 2025

Changeset 56526


Ignore:
Timestamp:
09/06/2023 09:21:17 PM (2 years ago)
Author:
flixos90
Message:

Bundled Theme: Update default themes to use new script function signature.

In WordPress 6.3, the last parameter of wp_register_script() and wp_enqueue_script() was changed to an array rather than a boolean. While a boolean is still supported for backward compatibility, it makes sense to update the codebase to use the new signature.

The updates are fully backward compatible:

  • In places where true was provided, array( 'in_footer' => true ) will still be interpreted as a boolean true in WordPress versions prior to 6.3.
  • In places where false was provided, the parameter is omitted which will work correctly throughout all WordPress versions given that is and has been the default value anyway.

Props mrinal013, huzaifaalmesbah, niravsherasiya7707, joemcgill.
Fixes #59302.
See #58634.

Location:
trunk/src/wp-content/themes
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyeleven/inc/theme-options.php

    r55420 r56526  
    674674 */
    675675function twentyeleven_customize_preview_js() {
    676     wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20150401', true );
     676    wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20150401', array( 'in_footer' => true ) );
    677677}
    678678add_action( 'customize_preview_init', 'twentyeleven_customize_preview_js' );
  • trunk/src/wp-content/themes/twentyfifteen/functions.php

    r56315 r56526  
    445445
    446446    // Skip-link fix is no longer enqueued by default.
    447     wp_register_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20230526', true );
     447    wp_register_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20230526', array( 'in_footer' => true ) );
    448448
    449449    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
     
    455455    }
    456456
    457     wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20221101', true );
     457    wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20221101', array( 'in_footer' => true ) );
    458458    wp_localize_script(
    459459        'twentyfifteen-script',
  • trunk/src/wp-content/themes/twentyfifteen/inc/customizer.php

    r55981 r56526  
    360360 */
    361361function twentyfifteen_customize_control_js() {
    362     wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20141216', true );
     362    wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20141216', array( 'in_footer' => true ) );
    363363    wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() );
    364364}
     
    371371 */
    372372function twentyfifteen_customize_preview_js() {
    373     wp_enqueue_script( 'twentyfifteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', true );
     373    wp_enqueue_script( 'twentyfifteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', array( 'in_footer' => true ) );
    374374}
    375375add_action( 'customize_preview_init', 'twentyfifteen_customize_preview_js' );
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r56315 r56526  
    368368
    369369    if ( is_front_page() && 'slider' === get_theme_mod( 'featured_content_layout' ) ) {
    370         wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20150120', true );
     370        wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20150120', array( 'in_footer' => true ) );
    371371        wp_localize_script(
    372372            'twentyfourteen-slider',
     
    379379    }
    380380
    381     wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20230526', true );
     381    wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20230526', array( 'in_footer' => true ) );
    382382}
    383383add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );
  • trunk/src/wp-content/themes/twentyfourteen/inc/customizer.php

    r48067 r56526  
    143143 */
    144144function twentyfourteen_customize_preview_js() {
    145     wp_enqueue_script( 'twentyfourteen_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20141015', true );
     145    wp_enqueue_script( 'twentyfourteen_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20141015', array( 'in_footer' => true ) );
    146146}
    147147add_action( 'customize_preview_init', 'twentyfourteen_customize_preview_js' );
  • trunk/src/wp-content/themes/twentyfourteen/inc/featured-content.php

    r55476 r56526  
    435435     */
    436436    public static function enqueue_scripts() {
    437         wp_enqueue_script( 'featured-content-suggest', get_template_directory_uri() . '/js/featured-content-admin.js', array( 'jquery', 'suggest' ), '20211130', true );
     437        wp_enqueue_script( 'featured-content-suggest', get_template_directory_uri() . '/js/featured-content-admin.js', array( 'jquery', 'suggest' ), '20211130', array( 'in_footer' => true ) );
    438438    }
    439439
  • trunk/src/wp-content/themes/twentynineteen/functions.php

    r56315 r56526  
    260260
    261261    if ( has_nav_menu( 'menu-1' ) ) {
    262         wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '20200129', true );
    263         wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '20230621', true );
     262        wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '20200129', array( 'in_footer' => true ) );
     263        wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '20230621', array( 'in_footer' => true ) );
    264264    }
    265265
  • trunk/src/wp-content/themes/twentynineteen/inc/customizer.php

    r48102 r56526  
    126126 */
    127127function twentynineteen_customize_preview_js() {
    128     wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20181214', true );
     128    wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20181214', array( 'in_footer' => true ) );
    129129}
    130130add_action( 'customize_preview_init', 'twentynineteen_customize_preview_js' );
     
    134134 */
    135135function twentynineteen_panels_js() {
    136     wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20181214', true );
     136    wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20181214', array( 'in_footer' => true ) );
    137137}
    138138add_action( 'customize_controls_enqueue_scripts', 'twentynineteen_panels_js' );
  • trunk/src/wp-content/themes/twentyseventeen/functions.php

    r56315 r56526  
    478478
    479479    // Skip-link fix is no longer enqueued by default.
    480     wp_register_script( 'twentyseventeen-skip-link-focus-fix', get_theme_file_uri( '/assets/js/skip-link-focus-fix.js' ), array(), '20161114', true );
    481 
    482     wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '20211130', true );
     480    wp_register_script( 'twentyseventeen-skip-link-focus-fix', get_theme_file_uri( '/assets/js/skip-link-focus-fix.js' ), array(), '20161114', array( 'in_footer' => true ) );
     481
     482    wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '20211130', array( 'in_footer' => true ) );
    483483
    484484    $twentyseventeen_l10n = array(
     
    487487
    488488    if ( has_nav_menu( 'top' ) ) {