Rate images with shortcodes

Auto added rating block is targeting actual post/page. But, using shortcodes, you can add custom rating blocks targetting different rating items. In this case, this page will show how to add stars rating block for an image from media library added to the page.

To generate the required shortcode, you can use the Shortcodes builder available as a menu item under the Rating System admin menu. Find Stars Rating / Single Item shortcode builder. We are gonna rate the image with ID 153, displayed below, so in the shortcode builder, enable ‘Rating object ID‘ option and set it to 153, and enable ‘Rating object Entity and Type‘ option and set it to Post Types: Media. You can adjust various other stuff for styling, and get shortcode on top of the builder that you can copy and paste into post/page editor. Code I use on this page is:

[gdrts_stars_rating type='posts.attachment' id='153' alignment='center' style_type='font' style_font_name='asterisk' style_size='48' font_color_empty='#ffffff' font_color_current='#8224e3' font_color_active='#dd3333']

So, block bellow shows the image, and under the image shortcode to rate that image. And, you can do this for multiple images on one page, make sure to generate shortcodes with proper ID’s.

Sea urchins ocean marine life
Rating: 3.55/5. From 5 votes.
Please wait...
Do you find the content of this page helpful?
Rating: +1. From 1 vote.
Please wait...