Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated: Use 6th parmeter of wp_enqueue_script() and wp_register_script() #5073

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-content/themes/twentyeleven/inc/theme-options.php
Expand Up @@ -673,6 +673,6 @@ function twentyeleven_customize_partial_blogdescription() {
* @since Twenty Eleven 1.3
*/
function twentyeleven_customize_preview_js() {
wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20150401', true );
wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20150401', array( 'in_footer' => true ) );
}
add_action( 'customize_preview_init', 'twentyeleven_customize_preview_js' );
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentyfifteen/functions.php
Expand Up @@ -444,7 +444,7 @@ function twentyfifteen_scripts() {
wp_style_add_data( 'twentyfifteen-ie7', 'conditional', 'lt IE 8' );

// Skip-link fix is no longer enqueued by default.
wp_register_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20230526', true );
wp_register_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20230526', array( 'in_footer' => true ) );

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
Expand All @@ -454,7 +454,7 @@ function twentyfifteen_scripts() {
wp_enqueue_script( 'twentyfifteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20141210' );
}

wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20221101', true );
wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20221101', array( 'in_footer' => true ) );
wp_localize_script(
'twentyfifteen-script',
'screenReaderText',
Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentyfifteen/inc/customizer.php
Expand Up @@ -359,7 +359,7 @@ function twentyfifteen_color_scheme_css() {
* @since Twenty Fifteen 1.0
*/
function twentyfifteen_customize_control_js() {
wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20141216', true );
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 ) );
wp_localize_script( 'color-scheme-control', 'colorScheme', twentyfifteen_get_color_schemes() );
}
add_action( 'customize_controls_enqueue_scripts', 'twentyfifteen_customize_control_js' );
Expand All @@ -370,7 +370,7 @@ function twentyfifteen_customize_control_js() {
* @since Twenty Fifteen 1.0
*/
function twentyfifteen_customize_preview_js() {
wp_enqueue_script( 'twentyfifteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', true );
wp_enqueue_script( 'twentyfifteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', array( 'in_footer' => true ) );
}
add_action( 'customize_preview_init', 'twentyfifteen_customize_preview_js' );

Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentyfourteen/functions.php
Expand Up @@ -367,7 +367,7 @@ function twentyfourteen_scripts() {
}

if ( is_front_page() && 'slider' === get_theme_mod( 'featured_content_layout' ) ) {
wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20150120', true );
wp_enqueue_script( 'twentyfourteen-slider', get_template_directory_uri() . '/js/slider.js', array( 'jquery' ), '20150120', array( 'in_footer' => true ) );
wp_localize_script(
'twentyfourteen-slider',
'featuredSliderDefaults',
Expand All @@ -378,7 +378,7 @@ function twentyfourteen_scripts() {
);
}

wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20230526', true );
wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20230526', array( 'in_footer' => true ) );
}
add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );

Expand Down
2 changes: 1 addition & 1 deletion src/wp-content/themes/twentyfourteen/inc/customizer.php
Expand Up @@ -142,7 +142,7 @@ function twentyfourteen_sanitize_layout( $layout ) {
* @since Twenty Fourteen 1.0
*/
function twentyfourteen_customize_preview_js() {
wp_enqueue_script( 'twentyfourteen_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20141015', true );
wp_enqueue_script( 'twentyfourteen_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20141015', array( 'in_footer' => true ) );
}
add_action( 'customize_preview_init', 'twentyfourteen_customize_preview_js' );

Expand Down
Expand Up @@ -434,7 +434,7 @@ public static function customize_register( $wp_customize ) {
* @since Twenty Fourteen 1.0
*/
public static function enqueue_scripts() {
wp_enqueue_script( 'featured-content-suggest', get_template_directory_uri() . '/js/featured-content-admin.js', array( 'jquery', 'suggest' ), '20211130', true );
wp_enqueue_script( 'featured-content-suggest', get_template_directory_uri() . '/js/featured-content-admin.js', array( 'jquery', 'suggest' ), '20211130', array( 'in_footer' => true ) );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentynineteen/functions.php
Expand Up @@ -259,8 +259,8 @@ function twentynineteen_scripts() {
wp_style_add_data( 'twentynineteen-style', 'rtl', 'replace' );

if ( has_nav_menu( 'menu-1' ) ) {
wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '20200129', true );
wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '20230621', true );
wp_enqueue_script( 'twentynineteen-priority-menu', get_theme_file_uri( '/js/priority-menu.js' ), array(), '20200129', array( 'in_footer' => true ) );
wp_enqueue_script( 'twentynineteen-touch-navigation', get_theme_file_uri( '/js/touch-keyboard-navigation.js' ), array(), '20230621', array( 'in_footer' => true ) );
}

wp_enqueue_style( 'twentynineteen-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' );
Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentynineteen/inc/customizer.php
Expand Up @@ -125,15 +125,15 @@ function twentynineteen_customize_partial_blogdescription() {
* Bind JS handlers to instantly live-preview changes.
*/
function twentynineteen_customize_preview_js() {
wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20181214', true );
wp_enqueue_script( 'twentynineteen-customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array( 'customize-preview' ), '20181214', array( 'in_footer' => true ) );
}
add_action( 'customize_preview_init', 'twentynineteen_customize_preview_js' );

/**
* Load dynamic logic for the customizer controls area.
*/
function twentynineteen_panels_js() {
wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20181214', true );
wp_enqueue_script( 'twentynineteen-customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20181214', array( 'in_footer' => true ) );
}
add_action( 'customize_controls_enqueue_scripts', 'twentynineteen_panels_js' );

Expand Down
8 changes: 4 additions & 4 deletions src/wp-content/themes/twentyseventeen/functions.php
Expand Up @@ -477,16 +477,16 @@ function twentyseventeen_scripts() {
wp_script_add_data( 'html5', 'conditional', 'lt IE 9' );

// Skip-link fix is no longer enqueued by default.
wp_register_script( 'twentyseventeen-skip-link-focus-fix', get_theme_file_uri( '/assets/js/skip-link-focus-fix.js' ), array(), '20161114', true );
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 ) );

wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '20211130', true );
wp_enqueue_script( 'twentyseventeen-global', get_theme_file_uri( '/assets/js/global.js' ), array( 'jquery' ), '20211130', array( 'in_footer' => true ) );

$twentyseventeen_l10n = array(
'quote' => twentyseventeen_get_svg( array( 'icon' => 'quote-right' ) ),
);

if ( has_nav_menu( 'top' ) ) {
wp_enqueue_script( 'twentyseventeen-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array( 'jquery' ), '20210122', true );
wp_enqueue_script( 'twentyseventeen-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array( 'jquery' ), '20210122', array( 'in_footer' => true ) );
$twentyseventeen_l10n['expand'] = __( 'Expand child menu', 'twentyseventeen' );
$twentyseventeen_l10n['collapse'] = __( 'Collapse child menu', 'twentyseventeen' );
$twentyseventeen_l10n['icon'] = twentyseventeen_get_svg(
Expand All @@ -499,7 +499,7 @@ function twentyseventeen_scripts() {

wp_localize_script( 'twentyseventeen-global', 'twentyseventeenScreenReaderText', $twentyseventeen_l10n );

wp_enqueue_script( 'jquery-scrollto', get_theme_file_uri( '/assets/js/jquery.scrollTo.js' ), array( 'jquery' ), '2.1.3', true );
wp_enqueue_script( 'jquery-scrollto', get_theme_file_uri( '/assets/js/jquery.scrollTo.js' ), array( 'jquery' ), '2.1.3', array( 'in_footer' => true ) );

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentyseventeen/inc/customizer.php
Expand Up @@ -245,14 +245,14 @@ function twentyseventeen_is_view_with_layout_option() {
* Bind JS handlers to instantly live-preview changes.
*/
function twentyseventeen_customize_preview_js() {
wp_enqueue_script( 'twentyseventeen-customize-preview', get_theme_file_uri( '/assets/js/customize-preview.js' ), array( 'customize-preview' ), '20161002', true );
wp_enqueue_script( 'twentyseventeen-customize-preview', get_theme_file_uri( '/assets/js/customize-preview.js' ), array( 'customize-preview' ), '20161002', array( 'in_footer' => true ) );
}
add_action( 'customize_preview_init', 'twentyseventeen_customize_preview_js' );

/**
* Load dynamic logic for the customizer controls area.
*/
function twentyseventeen_panels_js() {
wp_enqueue_script( 'twentyseventeen-customize-controls', get_theme_file_uri( '/assets/js/customize-controls.js' ), array(), '20161020', true );
wp_enqueue_script( 'twentyseventeen-customize-controls', get_theme_file_uri( '/assets/js/customize-controls.js' ), array(), '20161020', array( 'in_footer' => true ) );
}
add_action( 'customize_controls_enqueue_scripts', 'twentyseventeen_panels_js' );
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentysixteen/functions.php
Expand Up @@ -413,7 +413,7 @@ function twentysixteen_scripts() {
wp_script_add_data( 'twentysixteen-html5', 'conditional', 'lt IE 9' );

// Skip-link fix is no longer enqueued by default.
wp_register_script( 'twentysixteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20230526', true );
wp_register_script( 'twentysixteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20230526', array( 'in_footer' => true ) );

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
Expand All @@ -423,7 +423,7 @@ function twentysixteen_scripts() {
wp_enqueue_script( 'twentysixteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20170530' );
}

wp_enqueue_script( 'twentysixteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20230629', true );
wp_enqueue_script( 'twentysixteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20230629', array( 'in_footer' => true ) );

wp_localize_script(
'twentysixteen-script',
Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentysixteen/inc/customizer.php
Expand Up @@ -486,7 +486,7 @@ function twentysixteen_color_scheme_css() {
* @since Twenty Sixteen 1.0
*/
function twentysixteen_customize_control_js() {
wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20170530', true );
wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20170530', array( 'in_footer' => true ) );
wp_localize_script( 'color-scheme-control', 'colorScheme', twentysixteen_get_color_schemes() );
}
add_action( 'customize_controls_enqueue_scripts', 'twentysixteen_customize_control_js' );
Expand All @@ -497,7 +497,7 @@ function twentysixteen_customize_control_js() {
* @since Twenty Sixteen 1.0
*/
function twentysixteen_customize_preview_js() {
wp_enqueue_script( 'twentysixteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20170530', true );
wp_enqueue_script( 'twentysixteen-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20170530', array( 'in_footer' => true ) );
}
add_action( 'customize_preview_init', 'twentysixteen_customize_preview_js' );

Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentythirteen/functions.php
Expand Up @@ -321,7 +321,7 @@ function twentythirteen_scripts_styles() {
}

// Loads JavaScript file with functionality specific to Twenty Thirteen.
wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20230526', true );
wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20230526', array( 'in_footer' => true ) );

// Add Source Sans Pro and Bitter fonts, used in the main stylesheet.
$font_version = ( 0 === strpos( (string) twentythirteen_fonts_url(), get_template_directory_uri() . '/' ) ) ? '20230328' : null;
Expand Down Expand Up @@ -843,7 +843,7 @@ function twentythirteen_customize_partial_blogdescription() {
* @since Twenty Thirteen 1.0
*/
function twentythirteen_customize_preview_js() {
wp_enqueue_script( 'twentythirteen-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20200516', true );
wp_enqueue_script( 'twentythirteen-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20200516', array( 'in_footer' => true ) );
}
add_action( 'customize_preview_init', 'twentythirteen_customize_preview_js' );

Expand Down
4 changes: 2 additions & 2 deletions src/wp-content/themes/twentytwelve/functions.php
Expand Up @@ -188,7 +188,7 @@ function twentytwelve_scripts_styles() {
}

// Adds JavaScript for handling the navigation menu hide-and-show behavior.
wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20141205', true );
wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20141205', array( 'in_footer' => true ) );

$font_url = twentytwelve_get_font_url();
if ( ! empty( $font_url ) ) {
Expand Down Expand Up @@ -692,7 +692,7 @@ function twentytwelve_customize_partial_blogdescription() {
* @since Twenty Twelve 1.0
*/
function twentytwelve_customize_preview_js() {
wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20200516', true );
wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20200516', array( 'in_footer' => true ) );
}
add_action( 'customize_preview_init', 'twentytwelve_customize_preview_js' );

Expand Down
12 changes: 6 additions & 6 deletions src/wp-content/themes/twentytwenty/functions.php
Expand Up @@ -213,7 +213,7 @@ function twentytwenty_register_scripts() {
wp_enqueue_script( 'comment-reply' );
}

wp_enqueue_script( 'twentytwenty-js', get_template_directory_uri() . '/assets/js/index.js', array(), $theme_version, false );
wp_enqueue_script( 'twentytwenty-js', get_template_directory_uri() . '/assets/js/index.js', array(), $theme_version );
wp_script_add_data( 'twentytwenty-js', 'async', true );

}
Expand Down Expand Up @@ -431,7 +431,7 @@ function twentytwenty_block_editor_styles() {
}

// Enqueue the editor script.
wp_enqueue_script( 'twentytwenty-block-editor-script', get_theme_file_uri( '/assets/js/editor-script-block.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), true );
wp_enqueue_script( 'twentytwenty-block-editor-script', get_theme_file_uri( '/assets/js/editor-script-block.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), array( 'in_footer' => true ) );
}

add_action( 'enqueue_block_editor_assets', 'twentytwenty_block_editor_styles', 1, 1 );
Expand Down Expand Up @@ -625,13 +625,13 @@ function twentytwenty_customize_controls_enqueue_scripts() {
$theme_version = wp_get_theme()->get( 'Version' );

// Add main customizer js file.
wp_enqueue_script( 'twentytwenty-customize', get_template_directory_uri() . '/assets/js/customize.js', array( 'jquery' ), $theme_version, false );
wp_enqueue_script( 'twentytwenty-customize', get_template_directory_uri() . '/assets/js/customize.js', array( 'jquery' ), $theme_version );

// Add script for color calculations.
wp_enqueue_script( 'twentytwenty-color-calculations', get_template_directory_uri() . '/assets/js/color-calculations.js', array( 'wp-color-picker' ), $theme_version, false );
wp_enqueue_script( 'twentytwenty-color-calculations', get_template_directory_uri() . '/assets/js/color-calculations.js', array( 'wp-color-picker' ), $theme_version );

// Add script for controls.
wp_enqueue_script( 'twentytwenty-customize-controls', get_template_directory_uri() . '/assets/js/customize-controls.js', array( 'twentytwenty-color-calculations', 'customize-controls', 'underscore', 'jquery' ), $theme_version, false );
wp_enqueue_script( 'twentytwenty-customize-controls', get_template_directory_uri() . '/assets/js/customize-controls.js', array( 'twentytwenty-color-calculations', 'customize-controls', 'underscore', 'jquery' ), $theme_version );
wp_localize_script( 'twentytwenty-customize-controls', 'twentyTwentyBgColors', twentytwenty_get_customizer_color_vars() );
}

Expand All @@ -647,7 +647,7 @@ function twentytwenty_customize_controls_enqueue_scripts() {
function twentytwenty_customize_preview_init() {
$theme_version = wp_get_theme()->get( 'Version' );

wp_enqueue_script( 'twentytwenty-customize-preview', get_theme_file_uri( '/assets/js/customize-preview.js' ), array( 'customize-preview', 'customize-selective-refresh', 'jquery' ), $theme_version, true );
wp_enqueue_script( 'twentytwenty-customize-preview', get_theme_file_uri( '/assets/js/customize-preview.js' ), array( 'customize-preview', 'customize-selective-refresh', 'jquery' ), $theme_version, array( 'in_footer' => true ) );
wp_localize_script( 'twentytwenty-customize-preview', 'twentyTwentyBgColors', twentytwenty_get_customizer_color_vars() );
wp_localize_script( 'twentytwenty-customize-preview', 'twentyTwentyPreviewEls', twentytwenty_get_elements_array() );

Expand Down
Expand Up @@ -69,15 +69,15 @@ public function editor_custom_color_variables() {
get_template_directory_uri() . '/assets/js/dark-mode-toggler.js',
array(),
'1.0.0',
true
array( 'in_footer' => true )
);

wp_enqueue_script(
'twentytwentyone-editor-dark-mode-support',
get_template_directory_uri() . '/assets/js/editor-dark-mode-support.js',
array( 'twentytwentyone-dark-mode-support-toggle' ),
'1.0.0',
true
array( 'in_footer' => true )
);
}

Expand Down Expand Up @@ -115,7 +115,7 @@ public function customize_controls_enqueue_scripts() {
get_template_directory_uri() . '/assets/js/customize.js',
array( 'customize-base', 'customize-controls', 'underscore', 'jquery', 'twentytwentyone-customize-helpers' ),
'1.0.0',
true
array( 'in_footer' => true )
);
}

Expand Down