Plugin Contributor
dudo
(@dudo)
Hi, I see some strange characters in your strings, be sure to always use this symbol instead of this .
Further, if you need to use “large” size, you don’t need to declare it.
So, the shortcode should appear like this
[yasr_visitor_votes readonly="yes" postid="116"]
Best,
Dario
Yes, I could make the stars to appear. The problem is that I want to get the average number of the votes and show it as text or numbers.
For example:
Rating: 5.0
Plugin Contributor
dudo
(@dudo)
Ah ok, now I see.
Now this is not possible, I will add an hook in the next version where an user can returns what is needed.
Best,
Dario
Plugin Contributor
dudo
(@dudo)
Update to version 2.5.1, I’ve added some filters.
In your case, to accomplish your needs, you can add this code in your child theme
add_filter('yasr_vv_shortcode', function($shortcode_html, $stored_votes) {
$number_of_votes = $stored_votes['number_of_votes'];
if ($number_of_votes > 0) {
$average_rating = $stored_votes['sum_votes']/$number_of_votes;
} else {
$average_rating = 0;
}
$average_rating=round($average_rating, 1);
return '<b>Rating:</b>'.$average_rating;
}, 10, 2);
add_filter('yasr_vv_txt_after', function($span_text_after_stars) {
return false;
}, 10, 1);
Remember to disable stats in settings.
Best,
Dario
Ok, thanks. Let me get this:
It is correct if I add a code snippet only in the page I will insert the table from “WP Table Builder”. Inside this table I will show the following code:
[yasr_visitor_votes readonly="yes" postid="116"]
And in the page that will show this table I put the code that you gave me?
So the code will find for each yasr_visitor_votes and will change it to show the Rating : numbers??