• Resolved p13patch

    (@p13patch)


    I am trying to display a list of Posts that have a review. I’m using the function glsr_get_reviews() and then looping through each to get the assigned posts and display the post name. I want to display the review rating next to the post name. The review object gives the rating for the review as a number, and the documentation provided says that the function glsr_star_rating() should allow you to build a 1-5 star rating HTML string. I input the numeric value in the function, and in my dev tools it looks like all the HTML is there, but nothing is displaying. anyone else run into this or know what the issue might be?

Viewing 1 replies (of 1 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    1. A more efficient way to get rated pages is like this:

    $posts = get_posts([
        'meta_query' => [
            ['key' => '_glsr_average', 'compare' => 'EXISTS'],
        ],
        'orderby' => 'meta_value_num',
        'post_type' => 'page',
        'posts_per_page' => 10,
    ]);

    2. Looks like a bug. For now, try this:

    $rating = get_post_meta($post->ID, '_glsr_average', true);
    
    printf('<div class="glsr">%s</div>',
        apply_filters('glsr_star_rating', null, $rating)
    );
Viewing 1 replies (of 1 total)
  • The topic ‘Issue using glsr_star_rating() function’ is closed to new replies.