how can i add class or span tag at sprintf?

i hope to add span tag or class at sprintf

I want to enlarge the text size of the numbers in front of me. So I want to add span tag or class only to text in front of me.

my code is

/**
* Filters the product average rating.
*
* @since 1.10.0
*
* @param float $average_rating average rating
* @param WC_Product $product the product object
*/
$average_rating = max( 0, (float) apply_filters( ‘wc_product_reviews_pro_product_rating_average’, $product->get_average_rating(), $product ) );

$reviews_count = max( 0, wc_product_reviews_pro_get_contributions_count( $product, ‘review’ ) );

/* translators: Placeholders: %s – average rating stars count (float casted as string to avoid trailing zeroes), %d – 5 stars total (integer) — (e.g “4.2 / 5 stars”) */
$reviews_label = sprintf( __( ‘%s / %d’, ‘woocommerce-product-reviews-pro’ ), $average_rating, 5 );

?>
<h3><?php echo esc_html( $reviews_label ); ?></h3>

<p><?php echo get_star_rating(); ?></p>

I tried many ways.
https://stackoverflow.com/questions/45312511/adding-class-to-element-in-php-code
I’ve taken a lot of reference to the above url

But all the results are printed like 4/5.
I don’t want it to be in print.

Is there a good solution?
thanks.

Read more here:: how can i add class or span tag at sprintf?

Leave a Reply

Your email address will not be published. Required fields are marked *