Automattic\WooCommerce\Blocks\Utils

BlockTemplateUtils::get_templates_directorypublic staticWC 1.0

Gets the directory where templates of a specific template type can be found.

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

Хуков нет.

Возвращает

Строку.

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

$result = BlockTemplateUtils::get_templates_directory( $template_type );
$template_type(строка)
wp_template or wp_template_part.
По умолчанию: 'wp_template'

Код BlockTemplateUtils::get_templates_directory() WC 11.0.1

public static function get_templates_directory( $template_type = 'wp_template' ) {
		$root_path                = dirname( __DIR__, 3 ) . '/' . self::TEMPLATES_ROOT_DIR . DIRECTORY_SEPARATOR;
		$templates_directory      = $root_path . self::DIRECTORY_NAMES['TEMPLATES'];
		$template_parts_directory = $root_path . self::DIRECTORY_NAMES['TEMPLATE_PARTS'];

	if ( 'wp_template_part' === $template_type ) {
		return $template_parts_directory;
	}

	if ( self::should_use_blockified_product_grid_templates() ) {
		return $templates_directory . '/blockified';
	}

	return $templates_directory;
}