Rating templates are used to display rating elements on the front end. This can include stars, text, current user rating, and other things. And, with the use of templates, you have a lot of control over the rating display.

This user guide is for the Default template for the Single Rating Block for the Thumbs Rating method.


Rating List is used for displaying the ordered list of rating items by different criteria. To do so, you can use one of the many provided templates each rating method has. Each rating method has two main list template, called Default List and Default Table both including additional actions and filters to control the display of the elements in the template without the need to directly modify the template. Because of that, the Default templates are the best solution to be used as a general purpose template with additional control through filters and actions. Other templates might include some actions and filters too, and you should check individual templates.

Templates display various elements of the rating block. Some of these elements can be controlled by providing additional settings though function (method) calls, or by using filters to modify these additional settings. Each rating method has different methods available and different filters to modify settings. This user guide will show the whole process of how Default template works, and how can you modify the results by using filters and actions provided, and it will include references to the used filters and actions.

Anatomy of the Default List Template

This guide will cover the default list template only. Default table template is quite similar but displays rating using the TABLE, and the list template uses OL/LI to list items. Here is the list template:

<?php // GDRTS Template: Default, List // ?>

<div class="<?php gdrts_loop()->render()->classes('gdrts-thumbnail-float-left'); ?>">
    <div class="gdrts-inner-wrapper">


if (gdrts_list()->have_items()) :



    while (gdrts_list()->have_items()) :

        $thumbnail = '';
        if (apply_filters('gdrts-template-thumbs-rating-default-list-show-thumbnail', true)) {
            $thumbnail_size = apply_filters('gdrts-template-thumbs-rating-default-list-thumbnail-size', array(64, 64));
            $thumbnail = gdrts_list()->item()->thumbnail($thumbnail_size);


    <li class="gdrts-rating-item">
        <?php if (!empty($thumbnail)) { ?>
        <div class="gdrts-item-thumbnail">
            <a href="<?php echo gdrts_list()->item()->url(); ?>"><?php echo $thumbnail; ?></a>
        <?php } ?>
        <div class="gdrts-item-information">
            <div class="gdrts-widget-rating-thumb"><?php gdrts_loop()->render()->thumbs(); ?></div>
            <a href="<?php echo gdrts_list()->item()->url(); ?>"><?php echo gdrts_list()->item()->title(); ?></a>
            <div class="gdrts-widget-rating"><?php gdrts_loop()->render()->rating(); ?></div>






else :

    _e("No items found.", "gd-rating-system");



        <?php gdrts_list()->json(); ?>


Line 3 renders main wrapping DIV using method to get CSS classes for this rating block using method call: gdrts_loop()->render()->classes(). If you are customizing the template you can pass one or more CSS class as a string argument for the classes() method. This method runs the filter for all the CSS classes to add:

The rest of the rating block is inside the DIV with the gdrts-inner-wrapper class. Line 8 checks if the list has any item to show. If it does, the list is open with the OL tag and follows the WHILE loop going through each item.


Filter gdrts-template-thumbs-rating-default-list-show-thumbnail is used to decide if the thumbnail for each item will be displayed (default: true). If yes, template now needs to get the thumbnail size to use. For this, check out the filter:

Render the item

Lines from 27 to 38 are used to display single rating element. For this, template by default, show title of the item, rating text and rating thumbs. To show the rating text plugin uses the method: gdrts_loop()->render()->rating().

Or, if you prefer to use the filter, check out the filter gdrts_render_list_thumbs_rating_args_rating. This filter allows you to modify the strings displaying the rating text. This filter works with all the templates, not just the Default one, if the template calls the rating() rendering method.

Stars are rendered using the method call: gdrts_loop()->render()->thumbs(). This method has various parameters you can set, or you can use the filter to modify them. For method information check this out:

Or, if you prefer to use the filter, check out the filter gdrts_render_list_thumbs_rating_args_stars. This filter works with all the templates, not just the Default one, if the template calls the thumbs() rendering method.

And, to display the item properties, the plugin uses the instance of the current item in the loop and calls the item method. Current item is gdrts_list()->item(), and that is essentially this class instance:

Other templates

The plugin includes more than just the Default template. But, these templates are simpler, they don’t have all the extra filters and actions Default template has. If you understand the Default template, you can think of other templates as examples of what else can be done with templates customization, and to help you started with your own templates.

Rate this user guide

You are not allowed to rate this post.


Leave a Reply