From 67983f4b124719d03e819dca8c59df9b11b00c97 Mon Sep 17 00:00:00 2001 From: thelovekesh Date: Wed, 29 Jun 2022 19:21:25 +0530 Subject: [PATCH] Update consition to add block attribute only if it's enabled in settings --- includes/embeds/class-amp-core-block-handler.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/embeds/class-amp-core-block-handler.php b/includes/embeds/class-amp-core-block-handler.php index 5bdfbe284d8..a9d439c5b28 100644 --- a/includes/embeds/class-amp-core-block-handler.php +++ b/includes/embeds/class-amp-core-block-handler.php @@ -91,9 +91,15 @@ public function filter_rendered_block( $block_content, $block ) { } if ( 'core/gallery' === $block['blockName'] ) { - $amp_options = AMP_Options_Manager::get_options(); - $block['attrs']['ampCarousel'] = (bool) $amp_options['gallery_carousel']; - $block['attrs']['ampLightbox'] = (bool) $amp_options['gallery_lightbox']; + $amp_options = AMP_Options_Manager::get_options(); + + if ( $amp_options['gallery_carousel'] ) { + $block['attrs']['ampCarousel'] = true; + } + + if ( $amp_options['gallery_lightbox'] ) { + $block['attrs']['ampLightbox'] = true; + } } if ( isset( $block['attrs'] ) && 'core/shortcode' !== $block['blockName'] ) {