[ad_1]
You can either use the [site_reviews_summary]
shortcode or the glsr_star_rating
function.
For example:
echo do_shortcode('[site_reviews_summary assigned_posts="post_id" hide="rating,summary,bars"]');
Or:
$postId = get_the_ID();
$rating = get_post_meta($postId, '_glsr_average', true);
$reviewCount = get_post_meta($postId, '_glsr_reviews', true);echo apply_filters('glsr_star_rating', null, $rating, $reviewCount);
You don’t need to cast the meta values to an integer/float as the helper function will sanitize the values for you.
And, if you want to sort your WP_Query by the average rating or the bayesian ranking, please see the examples on the Site Reviews > Help & Support > FAQ page.