Forums › Forums › Search & Filter Pro › Sort Results by star rating
- This topic has 36 replies, 2 voices, and was last updated 8 years ago by Anonymous.
-
Anonymous(Private) November 17, 2016 at 6:12 pm #70946
if ( $query->have_posts() ) { ?> Found <?php echo $query->found_posts; ?> Results<br /> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php while ($query->have_posts()) { $query->the_post(); ?> <div> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <p><br /><?php the_excerpt(); ?></p> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?> <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"; } ?><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></h6> <p>Votes: <?php echo get_post_meta( get_the_ID(), 'ratings_users', true ); ?><p> <p></p> <p><small></small></p> </div> <hr /> <?php } ?> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div> <div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div> <?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query ) ); } ?> </div> <?php } else { echo "No Results Found"; } ?>
-
AuthorPosts