Would you like users to rate form entries or user-submitted WordPress posts? Check out our star rating demo to see what you will create with this tutorial, and then get started with the steps below to add star ratings to your WordPress site.
Steps to add star ratings to your WordPress site
- Create a form called 'Ratings'. Add a Star rating field.
- Add a Hidden field to your form. Put [get param=entry] in the field. This will get the ID of the entry you are rating.
If you want to put this form in a post, insert [post_id] in the hidden field instead of [get param=entry].
- Go to edit the View which displays the entries/posts you want to rate. Insert your Ratings form in the 'Detail Page' content box. The shortcode will look like the shortcode below, where x is the form ID.
[formidable id=x minimize=1]
Preview the View and submit a couple of test entries in the Ratings form.
- Go back to edit your View to add the average star rating. Put [ frm-stats id=x type=star y="[id]"] in the Content of your View. Replace x with the ID of your star rating field and replace y with the ID of your hidden field.
If you have inserted your Ratings form in a post, use [ frm-stats id=x type=star y="[post_id]"] instead.
Star rating notes
Note: If there is extra space below your star ratings, add a div around your star rating shortcode like this:
<div id="average-star-rating">[ frm-stats id=x type=star y=[id]]</div>
Then, add the following class to your Formidable Global Settings → Form Styling → Custom CSS: