WordPress.org

Ready to get started?Download WordPress

Forums

kk Star Ratings
[resolved] Adding Microdata information (4 posts)

  1. mishta
    Member
    Posted 2 years ago #

    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="http://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="http://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="http://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="http://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="http://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="http://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>

    http://wordpress.org/extend/plugins/kk-star-ratings/

  2. Kamal Khan
    Member
    Plugin Author

    Posted 2 years ago #

    For your custom description (meta info) you can use jquery to handle this.

    I don't think this will be an appropriate option to have this in a new version.

  3. mishta
    Member
    Posted 2 years ago #

    I do not know if you are aware of the tendencies, but if take a look at Google Webmaster Tools you will see that Google have a testing tool for testing this: Rich Snippets Testing Tool.
    This means that Google encourages the use of this and I can reassure you that microdata is really working.
    All that I wrote above makes me believe that THIS HAS TO BE IN THE NEW VERSION!

  4. melissaaggie98@gmail.com
    Member
    Posted 1 year ago #

    I completely agree! Please put this in the new version, for GD Star Ratings already has this feature and it definitely helps drive traffic to your site from Google searches.

    GD Star Ratings is way too complicated though and doesn't work as well as your plugin does. If you were able to add this feature in a new version, yours would be the best option out there.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic