How to add Total Post and Total Comment in your Blog?


English Version
Do you know how to add Total Post and Total Comment in your blogspot / blog so it will become like below?

Total Post : 1234
Total Comment : 12345

Here is one easy way to do it.

Go to Layout > Add a Gadget > HTML/JavaScript , and paste the following code:




<script type="text/javascript">

function TotalPosts(json) {


document.write('<b>Total Posts: '+json.feed.openSearch$totalResults.$t+'</b>');

}

function TotalComments(json) {

document.write('<b>Total Comments: '+json.feed.openSearch$totalResults.$t+'</b>');

}


</script>


<script src="/feeds/posts/default?alt=json-in-script&callback=TotalPosts"></script>

<br/>

<script src="/feeds/comments/default?alt=json-in-script&callback=TotalComments"></script>




Save it and its DONE!



Malay Version
Tahukah anda bagaimana kita nak memaparkan bilangan Posting dan bilangan Komen di blog anda supaya ia akan kelihatan seperti di bawah?

Total Post : 1234
Total Comment : 12345

Ada satu cara yang mudah. Ikuti langkah-langkah di bawah:

Layout > Add a Gadget > HTML/JavaScript , dan paste kod di bawah:



<script type="text/javascript">

function TotalPosts(json) {


document.write('<b>Total Posts: '+json.feed.openSearch$totalResults.$t+'</b>');

}

function TotalComments(json) {

document.write('<b>Total Comments: '+json.feed.openSearch$totalResults.$t+'</b>');

}


</script>


<script src="/feeds/posts/default?alt=json-in-script&callback=TotalPosts"></script>

<br/>

<script src="/feeds/comments/default?alt=json-in-script&callback=TotalComments"></script>



Simpan dan Siap!

LaYaNLaH!!!

Post a Comment

Previous Post Next Post