[Plugin: kk Star Ratings] Adding Microdata information
-
I am trying to integrate into the code Microdata information.
To do so I altered the original code of kk-star-ratings/kk-ratings.php by adding some info.public function markup($id=false) { $markup = '<div itemscope itemtype="https://data-vocabulary.org/Review-aggregate" class="kk-ratings open"> <span>'.(!$id?get_the_ID():$id).'</span> <div class="stars-turned-on"> </div> <!--.stars-turned-on--> <div class="hover-panel"> <a href="javascript:void();" rel="star-1"></a> <a href="javascript:void();" rel="star-2"></a> <a href="javascript:void();" rel="star-3"></a> <a href="javascript:void();" rel="star-4"></a> <a href="javascript:void();" rel="star-5"></a> </div> <!--.hover-panel--> <div itemprop="rating" itemscope itemtype="https://data-vocabulary.org/Rating" class="casting-desc">'.$this->options['init_msg'].'</div> <div class="casting-thanks">Thanks!</div> <div class="casting-error">AAn error occurred!</div> <!--.casting-desc--> </div> <!--.kk-ratings-->'; $markup .= $this->options['clear']? '<br clear="both" />' : ''; return $markup; }
The resulted code in html page is:
<div itemscope="" itemtype="https://data-vocabulary.org/Review-aggregate" class="kk-ratings" style="float: left; opacity: 1; "> <span>33</span> <div class="stars-turned-on stars-turned-strict" style="display: block; width: 100%; "> </div> <!--.stars-turned-on--> <div class="hover-panel"> <a href="javascript:void();" rel="star-1" style="display: block; " class=""></a> <a href="javascript:void();" rel="star-2" style="display: block; " class=""></a> <a href="javascript:void();" rel="star-3" style="display: block; " class=""></a> <a href="javascript:void();" rel="star-4" style="display: block; " class=""></a> <a href="javascript:void();" rel="star-5" class="" style="display: block; "></a> </div> <!--.hover-panel--> <div itemprop="rating" itemscope="" itemtype="https://data-vocabulary.org/Rating" class="casting-desc" style="display: block; ">5/5 from 1 votes</div> <div class="casting-thanks" style="display: none; ">Thanks!</div> <div class="casting-error">An error occurred!</div> <!--.casting-desc--> </div>
I need to add the rating markings. I do not know how to do that…
I am sure this will lead to a new version of the plugin ….
The code:
<div itemprop="rating" itemscope="" itemtype="https://data-vocabulary.org/Rating" class="casting-desc" style="display: block; ">5/5 from 1 votes</div>
needs to be changed to …
<div itemprop="rating" itemscope="" itemtype="https://data-vocabulary.org/Rating" class="casting-desc" style="display: block; "><span itemprop="average">5</span>/<span itemprop="best">5</span> from <span itemprop="votes">1</span> votes</div>
- The topic ‘[Plugin: kk Star Ratings] Adding Microdata information’ is closed to new replies.