Saturday, October 1, 2016

Recent Posts Label Only Title

  1. Layout
  2. Add a Gadget
  3. HTML/JavaScript

Paste this code


<!-- Recent Posts by Label Start -->
<!-- code by brought2you.blogspot.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 + '">' + entryTitle + "</a> </li>";
document.write(item);
}
document.write('</ul>');
}
</script>
<script src="/feeds/posts/summary/-/Random?max-results=5&alt=json-in-script&callback=recentpostslist"></script><span style="font-size: 80%; float:right;">Get this <a href="http://brought2you.blogspot.com/2012/03/list-recent-posts-by-label.html">widget</a></span>
<!-- Recent Posts by Label End -->


note : blue color text and replace it with a label number to be displayed


 DEMO : 


look to the right

No comments:

Post a Comment