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!

Filter gdrts_render_list_stars_rating_args_rating is used to filter the parameters used for the rendering of rating text in the rating list for Stars Rating method templates. This filter has several arguments:

  • $atts: the array of parameters to filter
  • $render_object: the instance of the render object
  • $_rating: rating value
  • $_stars: max number of stars
  • $_votes: number of votes

Array $atts contains following elements:

  • before: HTML to show before the rating text.
  • after: HTML to show after the rating text.
  • show_votes: show number of votes.
  • rating: the string showing the rating. By default, this is: Rating: <strong>{$_rating}</strong>/{$_stars}.
  • votes: the string showing number of votes. By default, this is From {$_votes} vote.|From {$_votes} votes.

Example to change rating/votes strings

add_filter('gdrts_render_list_stars_rating_args_rating', 'custom__gdrts_render_list_stars_rating_args_rating', 10, 5);
function custom__gdrts_render_list_stars_rating_args_rating($atts, $obj, $_rating, $_stars, $_votes) {
  $atts['rating'] = sprintf('Rating: <strong>%s</strong>.', $_rating);
  $atts['votes'] = sprintf(_n("Based on %s vote.", "Based on %s votes.", $_votes), $_votes);

  return $atts;
Rate this reference

You are not allowed to rate this post.

Leave a Comment