WC_Brands::show_brand
Displays brand.
Method of the class: WC_Brands{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$WC_Brands = new WC_Brands(); $WC_Brands->show_brand();
WC_Brands::show_brand() WC Brands::show brand code WC 10.3.6
public function show_brand() {
global $post;
if ( is_singular( 'product' ) ) {
$terms = get_the_terms( $post->ID, 'product_brand' );
$brand_count = is_array( $terms ) ? count( $terms ) : 0;
$taxonomy = get_taxonomy( 'product_brand' );
$labels = $taxonomy->labels;
/* translators: %s - Label name */
$brand_output = wc_get_brands( $post->ID, ', ', ' <span class="posted_in">' . sprintf( _n( '%s: ', '%s: ', $brand_count, 'woocommerce' ), $labels->singular_name, $labels->name ), '</span>' );
/**
* Filter the brand output in product meta.
*
* @since 9.8.0
*
* @param string $brand_output The HTML output for brands.
* @param array $terms Array of brand term objects.
* @param int $post_id The product ID.
*/
echo apply_filters( 'woocommerce_product_brands_output', $brand_output, $terms, $post->ID ); // phpcs:ignore WordPress.Security.EscapeOutput
}
}