block_core_post_template_uses_featured_image example

function block_core_post_template_uses_featured_image( $inner_blocks ) {
    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;
        }
    }

    return false;
}

/** * Renders the `core/post-template` block on the server. * * @since 6.3.0 Changed render_block_context priority to `1`. * * @param array $attributes Block attributes. * @param string $content Block default content. * @param WP_Block $block Block instance. * * @return string Returns the output of the query, structured using the layout defined by the block's inner blocks. */
Home | Imprint | This part of the site doesn't use cookies.