Automattic\WooCommerce\Blocks\Utils

BlockTemplateUtils::get_block_template_title()public staticWC 1.0

Returns template titles.

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

Хуков нет.

Возвращает

Строку. Human friendly title.

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

$result = BlockTemplateUtils::get_block_template_title( $template_slug );
$template_slug(строка) (обязательный)
The templates slug (e.g. single-product).

Код BlockTemplateUtils::get_block_template_title() WC 8.7.0

public static function get_block_template_title( $template_slug ) {
	$plugin_template_types = self::get_plugin_block_template_types();
	if ( isset( $plugin_template_types[ $template_slug ] ) ) {
		return $plugin_template_types[ $template_slug ]['title'];
	} else {
		// Human friendly title converted from the slug.
		return ucwords( preg_replace( '/[\-_]/', ' ', $template_slug ) );
	}
}