Skip to content

Modification du paramètre (bool) $in_footer => (array) $strategy pour wp_register_script #444

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

Merged
merged 4 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions inc/Framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
use BEA\Theme\Framework\Services\Acf;
use BEA\Theme\Framework\Services\Assets;
use BEA\Theme\Framework\Services\Performance;
use BEA\Theme\Framework\Services\Assets_JS_Async;
use BEA\Theme\Framework\Services\Editor;
use BEA\Theme\Framework\Services\Editor_Patterns;
use BEA\Theme\Framework\Services\Gravity_Forms;
use BEA\Theme\Framework\Services\Menu;
use BEA\Theme\Framework\Services\Sidebar;
use BEA\Theme\Framework\Services\Svg;
use BEA\Theme\Framework\Services\Theme;
use BEA\Theme\Framework\Tools\Body_Class;
Expand All @@ -35,7 +33,6 @@ class Framework {
Theme::class,
Assets::class,
Performance::class,
Assets_JS_Async::class,
Editor::class,
Editor_Patterns::class,
Gravity_Forms::class,
Expand Down
2 changes: 1 addition & 1 deletion inc/Services/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function register_assets(): void {
'dist/' . $file,
array_merge( [ 'jquery' ], $asset_data['dependencies'] ), // ensure jQuery dependency is set even if not declared explicitly in the JS
$asset_data['version'],
true
[ 'strategy' => 'defer' ]
);

wp_add_inline_script(
Expand Down
73 changes: 0 additions & 73 deletions inc/Services/Assets_JS_Async.php

This file was deleted.

1 change: 0 additions & 1 deletion inc/Services/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ private function add_theme_supports(): void {
add_theme_support( 'post-thumbnails' );
add_theme_support( 'html5', [ 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'script', 'style' ] );
add_theme_support( 'title-tag' );
add_theme_support( 'async-js' );
add_theme_support( 'yoast-seo-breadcrumbs' );
}

Expand Down
6 changes: 3 additions & 3 deletions inc/Tools/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ class Assets {
* @param $src : Have to be a relative filename
* @param array $deps
* @param mixed $ver
* @param bool $in_footer
* @param array $strategy
*
* @return bool
*/
public function register_script( string $handle, string $src, array $deps = [], $ver = false, bool $in_footer = false ): bool {
return \wp_register_script( $handle, \get_theme_file_uri( $src ), $deps, $ver, $in_footer );
public function register_script( string $handle, string $src, array $deps = [], $ver = false, array $strategy = [] ): bool {
return \wp_register_script( $handle, \get_theme_file_uri( $src ), $deps, $ver, $strategy );
}

/**
Expand Down
1 change: 1 addition & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ Version: 1.0.0
Author: BeAPI
Author URI: http://www.beapi.fr
Text Domain: beapi-frontend-framework
Requires at least: 6.3
*/
Loading