Friday, March 16, 2012

List Recent Post Titles By Label - Blogger Widget



List all or your most recent posts according to categories/labels

Copy the code below and paste it inside the content box

<!-- Recent Posts by Label Start -->
<!-- code by BloggerSentral.com -->
<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="http://satcore.blogspot.com/feeds/posts/summary/-/TV?max-results=500&alt=json-in-script&callback=recentpostslist"></script>
<span style="font-size: 80%; float:right;">Get this <a href="http://www.bloggersentral.com/2010/04/list-recent-posts-by-label.html">widget</a></span>
<!-- Recent Posts by Label End -->



  • Replace  http://satcore.blogspot.com  in code with your own blog URL.
  • Replace  TV  with the label. Labels are case sensitive, make sure you get it right.
  • Replace the value of  500 with the number of posts you want to display. To show all posts, use 500.
  • The titles are bulleted due the use of ordered list
  • If you want them numbered instead, just replace ul with ol.
  • Save, and see the result..

No comments:

Post a Comment