Support » Plugin: Simple Rating » Sorting posts

  • Resolved chowix


    Hello, I wanted to ask if there is a possibility to sort posts according to the star value of given posts?


Viewing 1 replies (of 1 total)
  • Plugin Author Igor Yavych


    Hello. Yes, that’s possible with a query like this for example (very basic):

    SELECT wp_posts.*, COALESCE(wp_spr_rating.points/wp_spr_rating.votes,0) as rating  FROM wp_posts 
    LEFT/INNER JOIN wp_spr_rating on wp_spr_rating.post_id = wp_posts.ID
    ORDER BY wp_spr_rating.points/wp_spr_rating.votes ASC/DESC
Viewing 1 replies (of 1 total)
  • The topic ‘Sorting posts’ is closed to new replies.