Retrieving ratings for JSON-LD markup
-
Fist of all, thank you for your great work and excellent support!
This is by far the best rating plugins for me in WP.
I am dealing with rich snippets and schema.org markup.
I got WP-PostRatings work perfectly with a schema type other than article.
After tweaking a bit with the plugin code I have modified the properties so to be consistent with the type (i.e. by changing “headline” to “name”, etc). Yet, I know that modifying the plugin code is not a good solution and could potentially break the code and lead to undesired results (not to mention that all changes will be lost with the first update).
It would be much more simple for me to call the proper ratings in my JSON-LD set with something like:“aggregateRating”: {
“@type”: “AggregateRating”,
“ratingValue”: “do code”,
“reviewCount”: “do code”
}I tried with a call like: “ratingValue”: “<?php if (function_exists(‘get_post_ratings_average’)): ?>
<?php get_post_ratings_average(); ?>
<?php endif; ?>”but it returns an empty field. I am not a programmer, thus I probably did it wrong.
All suggestions are truly appreciated!
The topic ‘Retrieving ratings for JSON-LD markup’ is closed to new replies.