Review count site reviews woocommerce loop title
-
Not sure if I’m in the right place for this, but I’m trying to display the review count next to the stars in the Woocommerce loop title (which works). However I would like it to display only when there are 1 or more reviews.
<div class="<?= $style; ?> glsrw-loop-rating" style="display: inline-block; margin: 0 auto;"> <?php if ($ratings->reviews ==1) : ?> <?= glsr_star_rating($ratings->average); ?><div class="count">(<?= sprintf('%s TEST', $ratings->reviews, 'woocommerce'), '<span class="count">'.esc_html($ratings->reviews).'</span>');?>)</div> </div>
And via hook
add_action('site-reviews-woocommerce/render/loop/rating', 'review_count_cat'); function review_count_cat() { if($ratings->reviews ==4) { ?> <div class="hey">hi </div> <?php } else { ?> <div class="hi">hey </div> <?php } }
One gives error, other ignores condition.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Review count site reviews woocommerce loop title’ is closed to new replies.