07 November 2009

Related Posts with Thumbnail Widget

Advertisements

I already posted Similar/Related Posts with image thumbnails widget. But here is another blogger hack for Related posts with more customization. In my previous widget you can only have 5 post titles, but using this new hack you can have more than 5 post titles. You can also control font, color and size of text.


LIVE DEMO


So here is easy 2 step procedure. Sign in to blogger >> Layout >> Edit HTML >> Download Full Template >> Expand Widget Template.
STEP 1

Press CTRL F and search
</head>

Now Add following code just above it:

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<style type='text/css'>
#related-posts {
float:center;
text-transform:none;
height:100%;
min-height:100%;
padding-top:5px;
padding-left:5px;
}

#related-posts h2{
font-size: 1.3em;
font-weight: bold;
color: black;
font-family: Georgia, &#8220;Times New Roman&#8221;, Times, serif;
margin-bottom: 0.75em;
margin-top: 0em;
padding-top: 0em;
}
#related-posts a{
color:black;
}
#related-posts a:hover{
color:black;
}

#related-posts  a:hover {
background-color:#d4eaf2;
}
</style>
<script src='http://free.blogger.help.googlepages.com/getrelatedpostswiththumb.txt' type='text/javascript'/>
</b:if>




STEP 2

Now look for

<div class='post-footer-line post-footer-line-1'>

or



<div class='post-footer-line post-footer-line-3'>

or



<p class='post-footer-line post-footer-line-1'>

or


<p class='post-footer-line post-footer-line-3'>

And after that add following code

<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div id='related-posts'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast != &quot;true&quot;'>
</b:if>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<script expr:src='&quot;/feeds/posts/default/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=related_results_labels_thumbs&amp;max-results=6&quot;' type='text/javascript'/></b:if></b:loop><a href='http://free-blogger-help.blogspot.com/' style='display:none;'>Related Posts with thumbnails</a><a href='http://free-blogger-help.blogspot.com/' style='display:none;'>blogger tutorials</a>
<script type='text/javascript'>
var currentposturl=&quot;<data:post.url/>&quot;;
var maxresults=5;
var relatedpoststitle="Related Posts";
removeRelatedDuplicates_thumbs();
printRelatedLabels_thumbs();
</script>
</div><div style='clear:both'/>
</b:if>

It's done. Save your template.

You can adjust the maximum number of related posts being displayed by changing value here

var maxresults=5;

You can also change the Related posts heading here

var relatedpoststitle="Related Posts";


Other Related Posts Widgets
  1. Related Posts/Similar Posts widget for blogger (2 different methods)
  2. LinkWithin Widget (Similar/Related posts with images) for Blogger/Wordpree/Typepad.
  3. Related Posts widget for blogger (based on Labels) 
  4. Related posts widget with thumbs and hovering effect

Related Posts

7 comments

April 8, 2010 at 6:06 AM

tq

May 27, 2010 at 5:57 AM

Hi, Thank you for posting the recent post with thumbnails. It worked like charm. But I couldn't add this related post to my blog .http://loveallraces.blogspot.com/
Could you tell me what went wrong? I don't want to use LinkWithin!!

May 27, 2010 at 9:43 PM

well I cant say what went wrong....did you followed all steps as mentioned....did you miss any code or step??

April 1, 2011 at 8:25 AM

I want to change the color of the font to the light purple or lilac that i have on my blog, but its not showing up and i want to make the link bigger

April 1, 2011 at 7:23 PM

Hi Niko

Make the changes in code of step 1

font-size: 1.3em;
font-weight: bold;
color: black;
font-family: Georgia, “Times New Roman”, Times, serif;

May 27, 2011 at 7:23 AM

can't find the step 2 code any of them in my blog.
ntr-blog.blogspot.com

May 28, 2011 at 6:52 AM

Hi Kaka

just look for

footer-line

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More