From 131c3a32ac3995f2adab1d94f882395c6eeca935 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Fri, 16 Aug 2024 13:10:11 +0200 Subject: [PATCH] Tiled Galleries: enqueue legacy script in footer and defer (#38928) Related conversation: p55Cj4-3qL-p2 Co-authored-by: =?UTF-8?q?S=C3=A9rgio=20Gomes?= --- .../plugins/jetpack/changelog/update-tiled-galleries-enqueue | 4 ++++ .../plugins/jetpack/modules/tiled-gallery/tiled-gallery.php | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 projects/plugins/jetpack/changelog/update-tiled-galleries-enqueue diff --git a/projects/plugins/jetpack/changelog/update-tiled-galleries-enqueue b/projects/plugins/jetpack/changelog/update-tiled-galleries-enqueue new file mode 100644 index 0000000000000..cd980722fb7cb --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-tiled-galleries-enqueue @@ -0,0 +1,4 @@ +Significance: patch +Type: enhancement + +Tiled Galleries: defer loading of the Tiled Gallery script for improved performance. diff --git a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php index 1039ae6078fa5..64681be2a7f3a 100644 --- a/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php +++ b/projects/plugins/jetpack/modules/tiled-gallery/tiled-gallery.php @@ -182,7 +182,10 @@ public static function default_scripts_and_styles() { ), array(), JETPACK__VERSION, - false + array( + 'in_footer' => true, + 'strategy' => 'defer', + ) ); wp_enqueue_style( 'tiled-gallery', plugins_url( 'tiled-gallery/tiled-gallery.css', __FILE__ ), array(), '2023-08-21' ); wp_style_add_data( 'tiled-gallery', 'rtl', 'replace' );