Hello,
I'm coding my own plugin.
I want to create a rating rich snippet in specific post/forum.
Here is the code of my plugin:
Since it's currently local, of course value $ratingvotesav is not update in showthread.
I tried to put $ratingvotesav in method call (function rating_snippet(&$thread, &$ratingvotesav) ) but it's not working.
Any idea ?
Another solution to my problem could be to dynamically change template from "showthread_ratethread" to "showthread_ratethread_with_snippet" in my plugin, but I don't know if it is possible, and how to do this...
I'm coding my own plugin.
I want to create a rating rich snippet in specific post/forum.
Here is the code of my plugin:
function rating_snippet(&$thread)
{
if($thread['numratings'] > 0)
{
$offer_name = $thread['subject'];
$offer_rating = $thread['averagerating'];
$offer_count = $thread['numratings'];
$ratingvotesav = "<div itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">
<div>Rating :
<span itemprop=\"ratingValue\">" . $offer_rating . "</span>/
<span itemprop=\"bestRating\">5</span>
(<span itemprop=\"ratingCount\">" . $offer_count . "</span> vote(s))
</div>
</div>";
}
}
Since it's currently local, of course value $ratingvotesav is not update in showthread.
I tried to put $ratingvotesav in method call (function rating_snippet(&$thread, &$ratingvotesav) ) but it's not working.
Any idea ?
Another solution to my problem could be to dynamically change template from "showthread_ratethread" to "showthread_ratethread_with_snippet" in my plugin, but I don't know if it is possible, and how to do this...