refactor
This commit is contained in:
@@ -470,7 +470,7 @@ function twentytwentyfour_test1_assets() {
|
||||
|
||||
wp_enqueue_style(
|
||||
'twentytwentyfour-test1-fonts',
|
||||
'https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700;800&display=swap',
|
||||
'https://fonts.googleapis.com/css2?family=Manrope:wght@400;700&display=swap',
|
||||
array(),
|
||||
null
|
||||
);
|
||||
@@ -546,6 +546,39 @@ function twentytwentyfour_test1_assets() {
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'twentytwentyfour_test1_assets', 100 );
|
||||
|
||||
/**
|
||||
* Trim non-critical WooCommerce frontend assets on the custom homepage.
|
||||
*
|
||||
* @since Twenty Twenty-Four 1.0
|
||||
* @return void
|
||||
*/
|
||||
function twentytwentyfour_optimize_front_page_assets() {
|
||||
if ( is_admin() || ! is_front_page() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$style_handles = array(
|
||||
'woocommerce-layout',
|
||||
'woocommerce-smallscreen',
|
||||
'woocommerce-general',
|
||||
'woocommerce-blocktheme',
|
||||
'wc-blocks-style',
|
||||
);
|
||||
|
||||
foreach ( $style_handles as $handle ) {
|
||||
wp_dequeue_style( $handle );
|
||||
}
|
||||
|
||||
wp_deregister_script( 'jquery-migrate' );
|
||||
|
||||
global $wp_scripts;
|
||||
|
||||
if ( $wp_scripts instanceof WP_Scripts && isset( $wp_scripts->registered['jquery'] ) ) {
|
||||
$wp_scripts->registered['jquery']->deps = array_diff( $wp_scripts->registered['jquery']->deps, array( 'jquery-migrate' ) );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'twentytwentyfour_optimize_front_page_assets', 120 );
|
||||
|
||||
/**
|
||||
* Send a formatted message to Telegram.
|
||||
*
|
||||
@@ -757,7 +790,7 @@ function twentytwentyfour_test1_shared_shell_assets() {
|
||||
|
||||
wp_enqueue_style(
|
||||
'twentytwentyfour-test1-fonts',
|
||||
'https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700;800&display=swap',
|
||||
'https://fonts.googleapis.com/css2?family=Manrope:wght@400;700&display=swap',
|
||||
array(),
|
||||
null
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user