ID, 'product_brand' ); $brand_count = is_array( $terms ) ? count( $terms ) : 0; $taxonomy = get_taxonomy( 'product_brand' ); if ( empty( $terms ) || ! is_array( $terms ) || is_wp_error( $terms ) || ! $taxonomy instanceof \WP_Taxonomy || ! function_exists( 'wc_get_brands' ) ) { return; } $labels = $taxonomy->labels; /* translators: %s - Label name */ $brand_output = wc_get_brands( $post->ID, ', ', ' ' . sprintf( _n( '%s: ', '%s: ', $brand_count, 'woocommerce' ), $labels->singular_name, $labels->name ), '' ); /** * 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 } /** * Get the instance of the class. * * @return Brands */ public static function get_instance() { if ( is_null( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } }