• Hi, I’m trying to use the star rate data result in other plugin, which needs the custom field name to get the data. thank you

Viewing 1 replies (of 1 total)
  • Plugin Contributor dudo

    (@dudo)

    Hello!

    It depends from what rating you need:

    if it is yasr_overall_rating, it is simply saved as post meta called yasr_overall_rating

    If, instead, you need data from yasr_visitor_votes, it is not saved as post_meta buy you can use this code:

    
    $votes_array       = YasrDatabaseRatings::getVisitorVotes($post_id);
    $votes_number      = $votes_array['number_of_votes'];
    
    if ($votes_number !== 0) {
        $medium_rating = ($votes_array['sum_votes'] / $votes_number);
    } else {
        $medium_rating = 0;
    }

    Best,
    Dario

    • This reply was modified 3 years, 3 months ago by dudo.
Viewing 1 replies (of 1 total)
  • The topic ‘Star rate custome field name’ is closed to new replies.