If you want all the posts of a particular label on your blog be listed, so that a viewer can easily click what he wants, this code does just that.
Maybe you wrote some posts that you categorised as fashion, and you want all with that label be listed, follow my guideline as below.
You have an option of
Go straight to the page where you want this to appear and paste the following code.
If you have used the blogger json code I taught in my {previous post} (for those with more than 500 posts on their blog), you need not include the values in blue color. Just omit it. Instead of the "<script src="/feeds/posts/default?max-results=500&alt=json-in-script&callback=listAllPosts"/>", just write
Maybe you wrote some posts that you categorised as fashion, and you want all with that label be listed, follow my guideline as below.
You have an option of
- showing or not, a thumbnail for each of the posts
- making links open in new tab or not
Go straight to the page where you want this to appear and paste the following code.
<script type='text/javascript'>
function listAllPosts(json){
document.write("<div>"+dPostLabel+"</div>")
document.write("<ol>");
var entry = json.feed.entry;
var thumb = false, openNewTab = false
for(var i=0; i<entry.length; i++){
try{for(var j=0; j<entry[i].category.length; j++){
if(entry[i].category[j].term==dPostLabel){
var pic ='';
if(thumb){var pic = '<img border="0" height="50" width="50" src="'+ entry[i].media$thumbnail.url + '" /><br />';}
var p = '<a href="'+ entry[i].link[4].href;
if(openNewTab){p = p + '" target="_blank';}
p = p + '">' + pic + entry[i].title.$t +'</a>';
document.write("<li>"+p+"</li>");}
}
}catch(e){}
}
document.write("</ol></div>");
}
var dPostLabel = "fashionlabel";
</script>
<script src="/feeds/posts/default?max-results=500&alt=json-in-script&callback=listAllPosts"/>That's it! Enter your custom values for the values in green colour
If you have used the blogger json code I taught in my {previous post} (for those with more than 500 posts on their blog), you need not include the values in blue color. Just omit it. Instead of the "<script src="/feeds/posts/default?max-results=500&alt=json-in-script&callback=listAllPosts"/>", just write
<script>listAllposts();</script>hope it works fine for you!