Hello there,
I have this kind of article rating for a custom post type:
Now I need a php function, that returns me the aggregated rating from all three rating fields for all ratings for one specific post object.
So something like one rating for the whole post.
Example two ratings for one post:
- Design: 2/5, Usability: 3/5, Speed: 5/5 (avg. 3/5)
- Design: 5/5, Usability: 5/5, Speed: 5/5 (avg. 5/5)
So the overall rating for this post would be 4/5.
Something similar to the Aggregate Rating used for the Google schemas.
So I suppose since you need this value for the Google Schema, there is a function, that returns me the rating value (like post_rating( $post ) or something).
Thanks you very much!
Regards,
Florian
You should use the same wpdiscuz_rating_schema hook and make the customization yourself.
But how can I get the rating value on any page for a specific post?
For example using a shortcode to display the rating of post with the id 123.
Because the schema filter only defines how the output schema in the source code will look like, right?
Or to say it in other words: I want to use the ratingValue (within the schema)
Or to even more precise: I want the $avarage value from this function:
Unfortunately I can't see the shortcode :/