Forums › Forums › Search & Filter Pro › Sort Results by star rating
- This topic has 36 replies, 2 voices, and was last updated 8 years, 7 months ago by
Anonymous.
-
Trevor(Private) November 17, 2016 at 4:30 pm #70898
Try this as the code to output stars:
<span id="post-ratings-<?php get_the_ID();?>" class="post-ratings"><?php $star_rating = get_post_meta( get_the_ID(), 'ratings_average', true ); for ( $star_count = 1, $star_count <= 5, $star_count++) { $star_status = "on"; if ( $star_rating < $star_count ) { $star_status = "off"; } ?><img id="rating_<?php get_the_ID();?>_<?php echo $star_count;?>" src="http://www.golf-library.com/wp-content/plugins/wp-postratings/images/stars/rating_<?php echo $star_status;?>.gif" alt="Star" title="Star"><?php } ?></span>
Anonymous(Private) November 17, 2016 at 5:54 pm #70938Done that but the page now doesn’t load…
<h6>Average Rating: <span id=”post-ratings-<?php get_the_ID();?>” class=”post-ratings”><?php
$star_rating = get_post_meta( get_the_ID(), ‘ratings_average’, true );
for ( $star_count = 1, $star_count <= 5, $star_count++) {
$star_status = “on”;
if ( $star_rating < $star_count ) {
$star_status = “off”;
}
?>_<?php echo $star_count;?>” src=”http://www.golf-library.com/wp-content/plugins/wp-postratings/images/stars/rating_<?php echo $star_status;?>.gif” alt=”Star” title=”Star”><?php } ?></span></h6> <p>Votes: <?php echo get_post_meta( get_the_ID(), ‘ratings_users’, true ); ?><p>
The indents have gone if that makes any difference?
-
AuthorPosts