| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template variables: |
| 4 |
* |
| 5 |
* @var $controllers array settings as array |
| 6 |
* @var $classes string visibility classes |
| 7 |
*/ |
| 8 |
|
| 9 |
// Do not allow directly accessing this file. |
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
exit( 'This script cannot be accessed directly.' ); |
| 12 |
} |
| 13 |
|
| 14 |
global $product; |
| 15 |
if ( empty( $product ) ) { |
| 16 |
return; |
| 17 |
} |
| 18 |
|
| 19 |
$cat_count = count( $product->get_category_ids() ); |
| 20 |
$tag_count = count( $product->get_tag_ids() ); |
| 21 |
$sku = $product->get_sku(); |
| 22 |
|
| 23 |
// Each label is wrapped in its own `.rtsb-meta-label` element (sibling of the value) so the |
| 24 |
// Label and Value typography/color controls can target separate elements. WooCommerce's |
| 25 |
// native markup keeps the label as a bare text node inside the row wrapper, which makes the |
| 26 |
// value inherit the label styles. |
| 27 |
$cat_before = '<span class="posted_in"><span class="rtsb-meta-label">' . esc_html( _n( 'Category:', 'Categories:', $cat_count, 'shopbuilder' ) ) . '</span> '; |
| 28 |
$tag_before = '<span class="tagged_as"><span class="rtsb-meta-label">' . esc_html( _n( 'Tag:', 'Tags:', $tag_count, 'shopbuilder' ) ) . '</span> '; |
| 29 |
?> |
| 30 |
<div class="rtsb-product-meta rtsb-is-sku rtsb-is-cat rtsb-is-brand rtsb-is-tag <?php echo esc_attr( $classes ); ?>"> |
| 31 |
<div class="product_meta"> |
| 32 |
|
| 33 |
<?php do_action( 'woocommerce_product_meta_start' ); ?> |
| 34 |
|
| 35 |
<?php if ( wc_product_sku_enabled() && ( $sku || $product->is_type( 'variable' ) ) ) : ?> |
| 36 |
<span class="sku_wrapper"><span class="rtsb-meta-label"><?php esc_html_e( 'SKU:', 'shopbuilder' ); ?></span> <span class="sku"><?php echo esc_html( $sku ? $sku : __( 'N/A', 'shopbuilder' ) ); ?></span></span> |
| 37 |
<?php endif; ?> |
| 38 |
|
| 39 |
<?php |
| 40 |
// wc_get_product_*_list() returns sanitized term links; safe to print as-is. |
| 41 |
echo wc_get_product_category_list( $product->get_id(), ', ', $cat_before, '</span>' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 42 |
echo wc_get_product_tag_list( $product->get_id(), ', ', $tag_before, '</span>' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 43 |
?> |
| 44 |
|
| 45 |
<?php do_action( 'woocommerce_product_meta_end' ); ?> |
| 46 |
|
| 47 |
</div> |
| 48 |
</div> |
| 49 |
|