How To Use WP Product Review Shortcodes
The WP Product Review plugin allows you to turn your boring text reviews to catchy product reviews, and it comes with a shortcodes feature which helps you build awesome product rating tables and place them anywhere in the post.
Shortcodes can also be used to insert more than 1 review in a post or page and come with different type of layouts which you can see in this demo.
The shortcode has three parameters (versions below 2.5.0 have only 2 parameters and only full, yes and no values for visual) which you can configure:
- post_id - ID of your post review.
- full - the full table view
- yes - just a knob review with or without the score
- no - just the rating, as a number
- rating - the rating section
- rating-options - the rating for options section
- pros-cons - the pros and cons section, as a visual
- default - the above option rendered through the default template
- style1 - the above option rendered through the first template
- style2 - the above option rendered through the second template
- (blank) - the above option rendered through the template in which it was created. This is the default option.
Using the [shortcode] to display a Review
Full Table Review
This is the shortcode to generate the full table review:
[P_REVIEW post_id=1765 visual='full']
Make sure to replace 1765 with the ID of your post.
Knob review with visual
The following shortcode can be used to generate only the review knob:
[P_REVIEW post_id=1765 visual='yes']
Only the review's rating, no visual
[P_REVIEW post_id=1765 visual='no']
The review's rating options section
[P_REVIEW post_id=1765 visual='rating-options']
The review's pros and cons section
[P_REVIEW post_id=1765 visual='pros-cons']
The review's rating options second, rendered through the first template
[P_REVIEW post_id=1765 visual='rating-options' template='style1']
The review's rating options second, rendered through the second template
[P_REVIEW post_id=1765 visual='rating-options' template='style2']
Using the [shortcode] directly in your theme's files
To use the shortcode outside the post and in your theme's files you can use the do_shortcode function:
<?php echo do_shortcode("[P_REVIEW post_id=1765 visual='yes']"); ?>
Always backup your site and use a child theme before attempting to modify your theme's files to prevent losing your data.
Use Elementor or SiteOrigin Widgets
If you have Elementor or SiteOrigin Widgets installed, you can use the widgets provided for them:
Where can I create reviews to use in my shortcodes?
You can follow along with the WP Product Review documentation to create reviews which you can display through shortcodes.