Automattic\WooCommerce\Blocks\Utils

BlockTemplateUtils::get_block_template()public staticWC 1.0

Retrieves a single unified template object using its id.

Метод класса: BlockTemplateUtils{}

Хуков нет.

Возвращает

WP_Block_Template|null. Template.

Использование

$result = BlockTemplateUtils::get_block_template( $id, $template_type );
$id(строка) (обязательный)
Template unique identifier (example: theme_slug//template_slug).
$template_type(строка) (обязательный)
Template type: 'wp_template' or 'wp_template_part'.
По умолчанию: 'wp_template'

Код BlockTemplateUtils::get_block_template() WC 7.5.1

public static function get_block_template( $id, $template_type ) {
	if ( function_exists( 'get_block_template' ) ) {
		return get_block_template( $id, $template_type );
	}

	if ( function_exists( 'gutenberg_get_block_template' ) ) {
		return gutenberg_get_block_template( $id, $template_type );
	}

	return null;

}