+44(0) 1234 567 890 info@domainname.com

Thursday, August 15, 2013

Show List of Post from a specific Label in Blogger

12:02 AM

Share it Please
It is an another Blogger widget to show list of posts from a particular or specific label.You can understand more about from the below screenshot.

Here blogging is my label name and posts below label name are the posts from that label. hope you understand the widget. Now let's go to tutorial.

Step 1 : Login to your Blogger.
Click on Layout.
Click on Add a Gadget

Click on Html/JavaScript


Step 2 : Add the following code 
<!-- Recent Posts by Label Start -->
<script type="text/javascript">
 function recentpostslist(json) { document.write('<ul>');
 for (var i = 0; i < json.feed.entry.length; i++) { for (var j = 0; j < json.feed.entry[i].link.length; j++) { if (json.feed.entry[i].link[j].rel == 'alternate') { break; } } var entryUrl = "'" + json.feed.entry[i].link[j].href + "'";//bs var entryTitle = json.feed.entry[i].title.$t;
var item = "<li>" + "<a href="+ entryUrl + '" target="_blank">' + entryTitle + "</a> </li>"; document.write(item); } document.write('</ul>'); }
</script> <script src="/feeds/posts/summary/-/YOUR_LABEL?max-results=8&alt=json-in-script&callback=recentpostslist"></script>
<!-- Recent Posts by Label End -->


Step 3 : Customization 
Change YOUR_LABEL with your label name.
Change 8 with number of posts you want to list from a label.
Now Save Widget ! Done !
Note : Use label name as Widget Title .