Many of my blog readers always ask me how to add related post thumbnail. So today for those I am posting the code of it. I hope other will also like who don't know about it. It look like on my blog as shown in below image.
If you're interested to put this widget on your site, please follow these steps:
Edit your template, Log in to your blogger dashboard - click on Design - Edit HTML and check the Expand Widget Templates. Find this code:
</head>
Now Add below code just above it
<b:if cond='data:blog.pageType == "item"'>
<style type='text/css'>
#related-posts {float:center;height:100%;min-height:100%;padding-top:5px;padding-left:5px;}
#related-posts h2{font-size: 1.6em;font-weight: bold;color:#000;font-family:Arial, Georgia;margin-bottom:0.75em;margin-top: 0em;padding-top: 0em;}
#related-posts a{-webkit-transition: background 1s ease, color 1s ease;-moz-transition: background 1s ease, color 1s ease;-o-transition: background 1s ease, color 1s ease;}
#related-posts a:hover{background-color:#d4eaf2;-webkit-transition: background 1s ease, color 1s ease;-moz-transition:background 1s ease, color 1s ease;-o-transition:background 1s ease, color 1s ease;-webkit-border-radius: 5px;-moz-border-radius:5px;border-radius:5px;-o-border-radius:5px;}
.tooltip{width: 115px; color:#000;font:lighter 12px/1.3 Arial,sans-serif;text-decoration:none;text-align:left}
.tooltip span.top{padding:20px 5px 0;background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHq2mUGCzQMzZK_0d2IIl6B7Ew54E4SOucCC6C03p6heY5m7pjzVCR5YHNOytK-Ik3ACnFcUDx8okG3J8lg8usW_MS2E8vgiNxyOQLJSIOXjaf_Ig5ptUoWi-WXTctWzg_NtyZIYHJzTE/s1600/bt.png) no-repeat top;}
.tooltip b.bottom{padding:2px 5px 6px;color:#548912;background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHq2mUGCzQMzZK_0d2IIl6B7Ew54E4SOucCC6C03p6heY5m7pjzVCR5YHNOytK-Ik3ACnFcUDx8okG3J8lg8usW_MS2E8vgiNxyOQLJSIOXjaf_Ig5ptUoWi-WXTctWzg_NtyZIYHJzTE/s1600/bt.png) no-repeat bottom;}
</style>
<script type='text/javascript'>window.onload=function(){enableTooltips("calcList")};imgBT=new Image();imgBT.src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr7CdmohnRFQG_T338oDehmmLcTiJyniHY20d7Gkd4urx9xhrC9ygdRzgR937k3mIblIYdg3IGLPJTwZuq7O_-kagjAkDDfWt-u9PpNk4hs3XMxV4xdA9XplIyTS249wmZRS3rUz8Yrt0/s1600/noimage.jpg';</script>
<script src='http://dvslabs.googlecode.com/files/rp-bubbled-thumbnails.js' type='text/javascript'></script>
</b:if>
<style type='text/css'>
#related-posts {float:center;height:100%;min-height:100%;padding-top:5px;padding-left:5px;}
#related-posts h2{font-size: 1.6em;font-weight: bold;color:#000;font-family:Arial, Georgia;margin-bottom:0.75em;margin-top: 0em;padding-top: 0em;}
#related-posts a{-webkit-transition: background 1s ease, color 1s ease;-moz-transition: background 1s ease, color 1s ease;-o-transition: background 1s ease, color 1s ease;}
#related-posts a:hover{background-color:#d4eaf2;-webkit-transition: background 1s ease, color 1s ease;-moz-transition:background 1s ease, color 1s ease;-o-transition:background 1s ease, color 1s ease;-webkit-border-radius: 5px;-moz-border-radius:5px;border-radius:5px;-o-border-radius:5px;}
.tooltip{width: 115px; color:#000;font:lighter 12px/1.3 Arial,sans-serif;text-decoration:none;text-align:left}
.tooltip span.top{padding:20px 5px 0;background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHq2mUGCzQMzZK_0d2IIl6B7Ew54E4SOucCC6C03p6heY5m7pjzVCR5YHNOytK-Ik3ACnFcUDx8okG3J8lg8usW_MS2E8vgiNxyOQLJSIOXjaf_Ig5ptUoWi-WXTctWzg_NtyZIYHJzTE/s1600/bt.png) no-repeat top;}
.tooltip b.bottom{padding:2px 5px 6px;color:#548912;background:url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHq2mUGCzQMzZK_0d2IIl6B7Ew54E4SOucCC6C03p6heY5m7pjzVCR5YHNOytK-Ik3ACnFcUDx8okG3J8lg8usW_MS2E8vgiNxyOQLJSIOXjaf_Ig5ptUoWi-WXTctWzg_NtyZIYHJzTE/s1600/bt.png) no-repeat bottom;}
</style>
<script type='text/javascript'>window.onload=function(){enableTooltips("calcList")};imgBT=new Image();imgBT.src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr7CdmohnRFQG_T338oDehmmLcTiJyniHY20d7Gkd4urx9xhrC9ygdRzgR937k3mIblIYdg3IGLPJTwZuq7O_-kagjAkDDfWt-u9PpNk4hs3XMxV4xdA9XplIyTS249wmZRS3rUz8Yrt0/s1600/noimage.jpg';</script>
<script src='http://dvslabs.googlecode.com/files/rp-bubbled-thumbnails.js' type='text/javascript'></script>
</b:if>
Next, Search for this:
post-footer-line post-footer-line-1
In which tag the this present, just place the below code after this:
<b:if cond='data:blog.pageType == "item"'>
<div id='related-posts'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast != "true"'>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels_thumbs&max-results=12"' type='text/javascript'/></b:if></b:loop>
<h4>Related Posts</h4>
<script type='text/javascript'>
var currentposturl="<data:post.url/>";
var maxresults=10;
var relatedpoststitle="";
removeRelatedDuplicates_thumbs();
printRelatedLabels_thumbs();
</script>
<div id='related-posts'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast != "true"'>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels_thumbs&max-results=12"' type='text/javascript'/></b:if></b:loop>
<h4>Related Posts</h4>
<script type='text/javascript'>
var currentposturl="<data:post.url/>";
var maxresults=10;
var relatedpoststitle="";
removeRelatedDuplicates_thumbs();
printRelatedLabels_thumbs();
</script>
</div><div style='clear:both'/>
</b:if>
</b:if>
Save your template and you're done. You may set the maximum number of related posts up to 20 posts. You can also customize it if you have small knowledge of HTML.
Telling you really it thought i must be a inbuilt feature from blogger and i was unable to add that and i needed this code from many time but just 3 day before i got the code. i would thank you for this if you have posted it just sometime before. well its great for new blogger. i m sharing it. :)
ReplyDeleteThis is nice. it is working. but it is effecting my widgets in blog side bar. some changes are taking place for widgets in blog side bar. what to do ?
ReplyDelete