Print rataing stars in PHP?
<?php
$average_reviews = round($post->average_reviews);
if(!empty($average_reviews)){
$i = 1;
while($i <= 5){
if($i <= $average_reviews){
?>
<img style="" src="<?php echo theme_url();?>/assets/img/organic.png">
<?php
}
else{
?>
<img style="" src="<?php echo theme_url();?>/assets/img/2017-10-10.png">
<?php
}
$i++;
}
echo "(" . $average_reviews . ")";
}
?>
Comments
Post a Comment