From b129fa042443c7fc3d45b4725cf96b5f5a19cc1a Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 30 Aug 2023 15:18:03 +0100 Subject: [PATCH 1/2] Ensure that CNAME accounts can deliver the Cloudinary Gallery --- php/media/class-gallery.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/php/media/class-gallery.php b/php/media/class-gallery.php index 0445f589d..a7acf1efe 100644 --- a/php/media/class-gallery.php +++ b/php/media/class-gallery.php @@ -131,6 +131,13 @@ public function get_config() { */ $config['container'] = apply_filters( 'cloudinary_gallery_html_container', '' ); + $credentials = $this->plugin->components['connect']->get_credentials(); + + if ( ! empty( $credentials['cname'] ) ) { + $config['secureDistribution'] = $credentials['cname']; + $config['privateCdn'] = true; + } + /** * Filter the gallery configuration. * From 5262fbc8bca7949825f81416bf8a7fb21fc68529 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 30 Aug 2023 15:18:43 +0100 Subject: [PATCH 2/2] Use the WooCommerce gallery wrapper to hook the Cloudinary Gallery --- php/media/class-woocommercegallery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/media/class-woocommercegallery.php b/php/media/class-woocommercegallery.php index 4dff76f20..5b06bb5de 100644 --- a/php/media/class-woocommercegallery.php +++ b/php/media/class-woocommercegallery.php @@ -95,7 +95,7 @@ public function setup_hooks() { add_filter( 'cloudinary_gallery_html_container', static function () { - return '.woocommerce-product-gallery'; + return '.woocommerce-product-gallery__wrapper'; } );