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_star_badge($atts = array())


Render star block with the rating value on top of the star element, in form of rating badge.


  • $aatts: array with display settings

$atts array

  • 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.
  • style_color: color for empty stars to use with font style.
  • title: custom text to add to the wrapper DIV title attribute.
  • font_size: size of the rating text value, in pixels.
  • font_color: color for the rating text value.


Display rating 4.2 rating badge:

<?php echo gdrts_render_custom_star_badge(
        array('rating' => 4.2, 
        'style_size' => 255, 'font_size' => 80)); ?>
Rating Badge Example
Rating Badge Example
Rate this reference

You are not allowed to rate this post.

Leave a Comment