All, have a movie review site that I assign a score to. Currently I'm using a widget which works fine...but I changed all of my scores to a 5 star rating system (3.5/5, 5/5, etc.) so the widget that was using it based on percentages to fill the progress bar (a score of 70 would fill 70% of the bar and so forth) now only displays 3.5% of that bar.
What I want to do is use the stars in font awesome, which I do have working on my site, instead.
But I'm having trouble modifying the widget code to suit my new needs.
I'm wondering if I need to make a case for each one or if there's an easier way? What I mean by "case" is by saying (and I'm saying this in English as opposed to code) "If the movie has a score of 1/5 then display one full star followed by four empty ones." And so forth. Or is there a way I can display the font awesome stars based on my dynamically-generated scores?
My widget code is below if that helps:
<?php
global $wp_query;
$postid = $wp_query->post->ID;
if( get_post_meta($postid, 'RankVideo', true)) {
echo '<div class="bar_mortice rounded"><div class="progress rounded" style="width: ' . get_post_meta($postid, 'RankVideo', true) . '%"></div></div>';
} elseif( get_post_meta($postid, 'ecpt_rankvideo', true)) {
echo '<div class="bar_mortice rounded"><div class="progress rounded" style="width: ' . get_post_meta($postid, 'ecpt_rankvideo', true) . '%"></div></div>';
}
?>
So basically I'm looking for the necessary edits to the above widget code to get it to display the star font awesome icons based on a 5 star rating system as opposed to the base 100 system I had before.
Make sense?