Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Im using WP-Postratings to show thumbs up or down for posts and I want to show on the homepage in post excerpts whether a post in in the plus or minus. If it's in the plus I want to show a custom image but if the negative I want to show a different image. Any ideas on how to do that?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Ok I figured this out. The ratings score is stored as a custom field so I created and if statements to check whether the score was less, equal, or greater than 0 and then I can show something accordingly. Here's how I set it up.

<?php 
  $ratings_score = get_post_meta($post->ID,'ratings_score',true); 
  if ($ratings_score < 0 ) {
      echo '<span>Plus</span>'; 
      } elseif ($ratings_score > 0 ) {
      echo '<span>Minus</span>';
      } else {
      echo '<span>Even</span>';
      }
 ?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.