Hello MillaN, i followed your video to make a simple custom template which works fine. But there’s one problem, i want to display only numbers like so:
4.6/5 (5)
that is: rating/5 (total votes)
however if i enable AJAX load addon, it will cause this error because i chose not to render the stars:
This is my template (un-commenting stars render solves the issue, but i don’t want to load them):
<?php // GDRTS Template: numbers-only // ?>
<div class="<?php gdrts_loop()->render()->classes(); ?>">
<div class="gdrts-inner-wrapper">
<?php do_action('gdrts-template-rating-block-before');
do_action('gdrts-template-stars-rating-default-before-rating-stars');
//gdrts_loop()->render()->stars();
do_action('gdrts-template-stars-rating-default-after-rating-stars');
//RATINGS
$item = $item = gdrts_get_rating_item_by_post();
if (isset($item->meta['stars-rating_rating'])) {
$rating = $item->meta['stars-rating_rating'];
$votes = $item->meta['stars-rating_votes'];
echo "<b>$rating</b>/5 ($votes)";
} else {
echo 'none';
}
gdrts_loop()->json();
do_action('gdrts-template-rating-block-after');
do_action('gdrts-template-rating-rich-snippet');
?>
</div>
</div>
- The topic ‘Enable Ajax on a template that doesn’t render stars cause error.’ is closed to new replies.
