kk Star Ratings
Show highest rated posts ONLY if there are 10+ total votes cast (1 post)

  1. Eckstein
    Posted 3 years ago #

    I am using the following code to display the most recent posts on a part of my site using this code:

    	$args = array( 'numberposts' => 4, 'meta_key' =>'_kksr_avg', 'orderby' =>'meta_value', 'order'=> 'DES','post_type' => 'tsv_userpost');
    	$postslist = get_posts( $args );
    	foreach ($postslist as $post) :
    	<?php  $postscast = get_post_meta ($post->ID, _kksr_casts, true); ?>
    			<a href="<?php  echo get_permalink (); ?>">
    	if ( has_post_thumbnail()):
    	the_post_thumbnail( 'missed-thumb', array( 'class' => 'missed-thumb' ) );
    			<span class="date">
    			<?php  the_time('M j'); ?>
    			<span class="rating">
    			 | <?php  echo get_post_meta($post->ID, _kksr_avg, true); ?>/5 Stars (rated by <?php  echo $postscast  ?> people)
    			<br />
    			<span class="title">
    			<a href="<?php  echo get_permalink (); ?>"><?php  echo get_the_title(); ?></a>
    <?php  endforeach; ?>

    I want to change this so that it only shows posts if they have at least 10 or more total votes casts (in order to prevent posts with only 1 vote of 5 starts from jumping straight to the top.)

    I'm sure there's some sort of if statement involved, but I can't quite figure out how to get it right.
    Can anyone help?


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • kk Star Ratings
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.