If you have custom code which relies on the Multi Rating Pro plugin and the plugin is disabled, a PHP fatal error will occur. It is best practice to first check the plugin is installed and activated before calling any API functions from a plugin. See class_exists() or function_exists() PHP functions.

Table of Contents

  1. Search Form
  2. Add ” ratings)” text to the end of the count
  3. Refresh Rating Item Results
  4. Increase font size of stars or thumbs
  5. Change the JSON-LD structured data (rich snippets)
  6. Custom WP Query Sort
  7. Automatically approve ratings > 3 out of 5 stars
  8. Check if user rating exists
  9. Rearrange comment form fields

Search Form

The code snippet below allows the user to select an overall star rating as search criteria in the search form. The star ratings are rounded half up or half down e.g. an overall star rating of 4.67/5 will show up in search results for 5 stars.

Add ” ratings)” text to the end of the count

Changes the count of rating entries displayed alongside the rating results to be “(X ratings)” instead of “(X)”.

Refresh Rating Item Results

By default, when a rating is saved, updated or deleted, only the rating results for the specific post and rating form are recalculated. If you are using the the [mrp_rating_item_results] shortcode or the rating_item_ids shortcode attribute (e.g. [mrp_rating_result rating_item_ids="1,2"]), the associated rating results are recalculated on page load (not immediately when a rating is saved, updated or deleted).

Increase font size of stars or thumbs

Font Awesome is used for the star and thumbs icons. To increase the size of the star and thumb icons you can simply increase the font-size using some CSS.

Change the JSON-LD structured data (rich snippets)<

See Google SEO rich snippets on how to setup. Here’s some code samples:

Custom WP Query Sort

Automatically approve ratings > 3 out of 5 stars

Check if user rating exists

Rearrange comment form fields

This code sample rearranges the comment form fields for anonymous users. It moves the comment, author, email and url fields to the end of the form. Therefore, any rating items, review fields or custom fields will be shown first in the comment form. Note the code sample relies on the comment_form_fields filter which is only available since WordPress 4.4.