Developer Knowledge Level

This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!

gdrts_render_custom_stars_block($atts = array())


Render stars block for a specified rating value and with custom settings. This function is not rendering rating block (active or disabled), it just simply shows a rating value as a stars block, nothing more. It is useful for showing rating in any place, where you already have rating value, and there is no need to have full rating block displayed.


  • $aatts: array with display settings

$atts array

  • stars: the total number of stars in the block, default: 5.
  • rating: rating that needs to be displayed, default: 0.
  • style_type: render style: font, fontawesome or image, default: font.
  • style_name: name of the style element, default: star.
  • style_size: size in pixels for individual star elements
  • style_class: additional CSS class to add to the block.
  • font_color_empty: color for empty stars to use with font style.
  • font_color_current: color for current stars to use with font style.
  • title: custom text to add to the wrapper DIV title attribute.


Display rating 4/5 with this code:

<?php echo gdrts_render_custom_stars_block(
        array('rating' => 4, 
        'style_name' => 'square', 'style_size' => 24)); ?>
Rate this reference

You are not allowed to rate this post.

Leave a Comment