• Resolved payamdigi

    (@payamdigi)


    hi
    thanks for your great plugin.

    I want to get (average rating) and (count of visitor ratings). I tried
    myvalue1 = $average_rating,
    myvalue2 = $visitor_votes[‘number_of_votes’],
    but they return (Null).
    whould you please help me?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor dudo

    (@dudo)

    Hello!

    You can use this code

    $ratings = YasrDatabaseRatings::getVisitorVotes($post_id);

    $ratings will be an array with these members:

    • number_of_votes
    • sum_votes
    • average

    so, $ratings[‘average’] and $ratings[‘number_of_votes’]

    Best,
    Dario

    Thread Starter payamdigi

    (@payamdigi)

    excellent!
    now I have one GREEN product (structured data) in my google console instead of two YELLOW ?

    thank you very much

    p.s. $ratings has two members: (number_of_votes) and (sum_votes)
    so I made a division to get (average)

    Plugin Contributor dudo

    (@dudo)

    p.s. $ratings has two members: (number_of_votes) and (sum_votes)
    so I made a division to get (average)

    Update to version 3.0.4 and you will get the average also ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get rating info’ is closed to new replies.