wpseek.com
WordPress开发者和主题制作者的搜索引擎



block_core_post_template_uses_featured_image › WordPress Function

Sincen/a
已弃用n/a
block_core_post_template_uses_featured_image ( $inner_blocks )
参数:
  • (WP_Block_List) $inner_blocks Inner block instance.
    Required: Yes
返回:
  • (bool) Whether the block list contains a block that uses the featured image.
定义在:
文档:

Determines whether a block list contains a block that uses the featured image.



源码

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;
}