How to Place Star Ratings in Blogger Template or Post ?

Easy Tips to Enable Star Rating in your Blogger Template




Enable Blogger in Draft. Go to Layout -> Page Elements then edit your Blog Posts widget.


Then mark the checkbox for "Show Star Ratings" and you can arrange where you want to place it relative to your other blog post elements.



However, if you downloaded a customized Blogger template from another site or made your own changes to the template, doing this won't work. You'll have to digg your code using these funny code.


<span class='star-ratings'>

<b:if cond='data:top.showStars'>

<div expr:g:background-color='data:backgroundColor' expr:g:text-color='data:textColor' expr:g:url='data:post.absoluteUrl' g:height='42' g:type='RatingPanel' g:width='180'/>

</b:if>

</span>



And this code:



<b:if cond='data:top.showStars'>

<script src='http://www.google.com/jsapi' type='text/javascript'/>

<script type='text/javascript'>

google.load("annotations", "1");

function initialize() {

google.annotations.setApplicationId(<data:top.blogspotReviews/>);

google.annotations.createAll();

google.annotations.fetch();

}

google.setOnLoadCallback(initialize);

</script>

</b:if>



Then go to Layout -> Edit HTML and mark the box Expand Widget Templates. Look for this line:



<data:post.body/>



And place the first piece of code after it to put it at the bottom of each of your posts. If you are comfortable with HTML, you might try other placements as well. Just don't forget to backup your template first.



Anyway, it should look something like this:



<div class='post-body'>

<p><data:post.body/></p>

<p><b:if cond='data:top.showStars'>

<div expr:g:url='data:post.absoluteUrl' g:height='42' g:type='RatingPanel' g:width='180'/>

</b:if></p>

<div style='clear: both;'/> <!-- clear for photos floats -->

</div>



The second piece of code, you should place between <b:include name='feedLinks'/> and </b:includable> like this:



<!-- feed links -->

<b:include name='feedLinks'/>



<b:if cond='data:top.showStars'>

<script src='http://www.google.com/jsapi' type='text/javascript'/>

<script type='text/javascript'>

google.load("annotations", "1");

function initialize() {

google.annotations.setApplicationId(<data:top.blogspotReviews/>);

google.annotations.createAll();

google.annotations.fetch();

}

google.setOnLoadCallback(initialize);

</script>

</b:if>

</b:includable>



Source : Randomdetox

Blogger Updates On Mail





Previous Post Next Post