Shortcodes

To manually output the average rating for a Page, Post or Custom Post Type, you can optionally use Comment Rating Field Pro’s shortcode, either within your Post’s content or elsewhere on your WordPress web site.

Using Shortcodes isn’t required – each Field Group allows you to choose how to display the average ratings within your Post Content and Excerpt.

Click the star icon in the Visual Editor toolbar:
Comment Rating Field Pro: Shortcode Button

Enter the following information:
Comment Rating Field Pro: Shortcode Modal

  • Enabled: Choose to display ratings on archive pages (this includes post lists, search results etc.)
    • Never Display
    • Display when ratings exist
    • Always Display
  • Position: Where to display the rating:
    • Above Content
    • Below Content
  • Style: Choose the style to display the ratings in
    • Yellow Stars only
    • Yellow Stars with Grey Stars
  • Show Average: Display the average of all ratings
    • Yes, using Stars
    • Yes, using Bars (Amazon Style)
    • No
  • Average Rating Text: Define the text you’d like to display before the average rating is displayed
  • Total Ratings: Choose whether to display the total count of ratings after the average
    • Do not display the total number of ratings after the average rating
    • Display the total number of ratings after the average rating
  • Show Breakdown: Choose to display a breakdown of all rating fields
    • Yes
    • No
  • Show Rating Number: Choose to display the rating number to the right of the star / bar
    • Yes, as Number
    • Yes, as Percentage
    • No
  • Filter Comments: Choose to link each breakdown in ‘Show Breakdown’. Clicking a rating within the breakdown will then show all comments that have that specific rating.
  • Link to Comments: Choose to link the Average Rating Text to the Comments section.
  • Post ID: Enter the Post ID to display the average rating for.  If none is supplied, the shortcode will use the current Post / Page being displayed to the visitor.
  • CSS ID: Optional CSS ID to apply to the average rating HTML
  • CSS Class: Optional CSS class to apply to the average rating HTML

A shortcode will then appear within the content:
[[crfp enabled=”1″ displayStyle=”” displayAverage=”0″ averageRatingText=”Average:” displayTotalRatings=”” totalRatingsBefore=”” totalRatingsAfter=”” displayBreakdown=”0″ displayRatingNumber=”0″ filterComments=”0″ displayLink=”0″ id=”” cssID=”” cssClass=””]]

Parameter Accepted Value Description
enabled 0 Never display average rating
1 Only display average rating when ratings exist on this Page / Post / CPT
2 Always display average rating, regardless of whether ratings exist.
displaystyle Yellow stars only
grey Yellow stars with grey stars
displayaverage 0 Don’t display average rating
1 Display average rating using stars
2 Display average rating using bars
averageratingtext Value = the label text to display before the average rating
displaytotalratings 0 Do not display the total number of ratings made
1 Display the total number of ratings made
totalratingsbefore Value = the label text to display before the total rating
totalratingsafter Value = the label text to display after the total rating
displaybreakdown 0 Do not show the rating breakdown (if multiple rating fields exist, each field’s rating would be displayed)
1 Show the rating breakdown
displayratingnumber 0 Don’t display the rating number
1 Do display the rating number to the right of the star / bar as a number
2 Do display the rating percentage to the right of the star / bar as a percentage
filtercomments 0 Don’t allow each rating in the average to be clicked to filter comments by that rating.
1 Do allow each rating in the average to be clicked to filter comments by that rating.
displaylink 0 Don’t link the average rating text to the comments section.
1 Do link the average rating text to the comments section.
id Show the average rating for the Post/Page/Custom Post the shortcode is inserted into.
100 Show the average rating for the Post/Page/Custom Post with ID = 100.
cssID Optional ID to add to the main rating HTML markup.
cssClass Optional CSS class(es) to add to the main rating HTML markup.