chore: complete M1.1 runtime QA and release packaging
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* Performance helpers – conditional asset loading, defer hints.
|
||||
*/
|
||||
|
||||
add_filter('script_loader_tag', 'xshop_defer_scripts', 10, 3);
|
||||
|
||||
function xshop_defer_scripts(string $tag, string $handle, string $src): string {
|
||||
// Defer theme script (not admin, not customizer preview).
|
||||
if ($handle === 'xshop' && !is_admin() && !is_customize_preview()) {
|
||||
if (str_contains($tag, ' defer')) { return $tag; }
|
||||
$tag = str_replace('<script ', '<script defer ', $tag);
|
||||
}
|
||||
return $tag;
|
||||
}
|
||||
Reference in New Issue
Block a user