Support » Plugin: Testimonial Rotator » False average rating in Schema mark-up

  • Resolved Yaroons


    Hi, thank you for a great plug-in but I ran into 1 weird problem.
    When I test the reviewpage on this page: the average rating (The value “hreview-aggregate”) doesn’t calculate the average right.

    I tested it and the average rating of 9 ratings of 5 stars = 5.
    The average rating of 8 x 5 stars and 1 x 4 = 4.
    The average rating of 7 x 5 stars, 1 x 4 and 1 x 3 = also 4.

    What I make up of this is that it seems to round the decimals.
    Now Google shows 4 out of 5 stars while it should show 4.8 or 4.9.

    Could you please fix this soon?
    This is in my opinion the only downside. Other than that this plug-in is just perfect!


Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Just wanted to let you know that I took a peek at your code and already solved the problem I described above.

    To solve it:

    On line 525 in testimonial-rotator.php


    $global_rating_number = floor($global_rating / $post_count);


    $global_rating_number = ($global_rating / $post_count);
    $global_rating_number = round($global_rating_number,1);

    and on line 530 (531 after you added the line above)

    remove .0


    echo "\t<div class=\"rating\">{$global_rating_number}.0</div>\n";

    Now it gives the right rating with one decimal.

    I hope you can implement this change in the next update.


    Plugin Author Hal Gatewood


    It’ll be in the next release. Thanks for your work on this!

    Hi Mr. Gatewood,

    That’s good news!
    I just updated it yesterday to the latest version again but had to change this bit after the update was done. Like I do after every update, because ofcourse I don’t want to show a 4 when it should show a 4.8 rating 🙂
    But that little bit of extra trouble was worth it every time because I absolutely love your plug-in.
    When this is fixed, you got the best rating plug-in out there, man!
    So you’re welcome and thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘False average rating in Schema mark-up’ is closed to new replies.