From c2d8dcd692fe5a162a73fee13eb3d4301697eb6d Mon Sep 17 00:00:00 2001 From: jrangel Date: Tue, 5 Nov 2024 07:06:09 +0000 Subject: [PATCH] Added foreach loop wrapper --- Gutenberg/check-inner-blocks.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Gutenberg/check-inner-blocks.php b/Gutenberg/check-inner-blocks.php index ae5f943..bedf6e2 100644 --- a/Gutenberg/check-inner-blocks.php +++ b/Gutenberg/check-inner-blocks.php @@ -1,4 +1,14 @@ - // Check if the block is a 'core/post-featured-image' - if ( 'core/post-featured-image' === $block->name ) { - return true; // Found a block using the featured image - } \ No newline at end of file +foreach ( $inner_blocks as $block ) { + if ( 'core/post-featured-image' === $block->name ) { + return true; + } + if ( + 'core/cover' === $block->name && + ! empty( $block->attributes['useFeaturedImage'] ) + ) { + return true; + } + if ( $block->inner_blocks && block_core_post_template_uses_featured_image( $block->inner_blocks ) ) { + return true; + } + } \ No newline at end of file