BlockTemplateUtilsDuplicated::convert_slug_to_title()
Converts template slugs into readable titles.
Метод класса: BlockTemplateUtilsDuplicated{}
Хуков нет.
Возвращает
Строку
. Human friendly title converted from the slug.
Использование
$result = BlockTemplateUtilsDuplicated::convert_slug_to_title( $template_slug );
- $template_slug(строка) (обязательный)
- The templates slug (e.g. single-product).
Код BlockTemplateUtilsDuplicated::convert_slug_to_title() BlockTemplateUtilsDuplicated::convert slug to title WC 9.6.1
public static function convert_slug_to_title( $template_slug ) { switch ( $template_slug ) { case 'single-product': return __( 'Single Product', 'woocommerce' ); case 'archive-product': return __( 'Product Archive', 'woocommerce' ); case 'taxonomy-product_cat': return __( 'Product Category', 'woocommerce' ); case 'taxonomy-product_tag': return __( 'Product Tag', 'woocommerce' ); default: // Replace all hyphens and underscores with spaces. return ucwords( preg_replace( '/[\-_]/', ' ', $template_slug ) ); } }