Stylish Popular Posts Widget For Blogger
Introduction
Popular Posts widget displays the most viewed or popular posts in your blog, however the default style isn't aesthetic enough to attract clicks or visits from your audience that's why I design a Stylish Popular Posts Widget that is without a doubt - stunning. With the use of some CSS I made the default style of popular posts a lot more beautiful.HTML
Go to Blogger » Template » Backup your Template » and Edit HTMLNow Search and Look for <!-- (4) Show snippets and thumbnails -->
You will find similar to this
Change the highlighted code with this code
<div class='item-st'>
<div class='item-title'><a expr:href='data:post.href'><data:post.title/></a></div>
<div class='item-snippet'><data:post.snippet/></div>
<div id='popularbutton'><div class='mbabuttons2 mbabutton mbabuttonred'>Read More</div></div>
</div>
CSS
Now copy the following code and paste it before ]]></b:skin>.PopularPosts .widget-content{background:#222}.PopularPosts .widget-content ul li .item-thumbnail img{position:relative;background:#fff;padding:10px;width:310px;height:100%}.PopularPosts .widget-content ul li .item-st{-webkit-box-sizing:border-box;-moz-box-sizing: border-box;box-sizing: border-box;position:absolute;background:#222;border:10px solid #fff;padding:20px;width:250px;bottom:1px;left:30px}.PopularPosts .widget-content ul li{position:relative;height:350px;font-family:'Maven Pro',sans-serif}.PopularPosts .widget-content ul li .item-title a{color:#fff;text-align:center;font-size:20px;text-decoration:none;text-transform:capitalize}.PopularPosts .widget-content ul li .item-title{text-align:center}.PopularPosts .widget-content ul li .item-snippet{text-align:justify;font-size:14px}#popularbutton{width:120px;margin:0 auto}.mbabuttons2{width:120px;height:38px;line-height:38px}.mbabutton{position:relative;font-size:17px;color:#fff;text-align:center;text-shadow:1px 1px 1px #99353e}.mbabuttonred{border:0;background:#ed5564;border-bottom:1px solid #bf424d;border-radius:3px;cursor:pointer;-webkit-box-shadow:inset 0 -1px #bf424d;-moz-box-shadow:inset 0 -1px #bf424d;box-shadow:inset 0 -1px #bf424d}
JScript
Search and Look for </body> and paste the following code before it<script type='text/javascript'>
//<![CDATA[
var newSize = 400; // this is the new thumbnail size, you can change this
$(".popular-posts .item-thumbnail img").each(function() {
var oldSize = $(this).attr("width");
$(this).attr("width", newSize); $(this).attr("height", newSize);
$(this).attr("src", $(this).attr("src").replace("/s"+oldSize+"-c/", "/s"+newSize+"-c/"));
});
//]]>
</script>
Final Words
We have set the maximum width of the image to 310px and maximum width of the post title and snippet to 250px, just adjust them to fit your need.So that's it for today, hope you find this Stylish Popular posts widget helpful.
- Comments
- 24 Blogger
- Disqus
These widget are very good. I used it on Electrical Objective Question blog.
ReplyDeleteThanks admin.
Thank you Prabhat!
DeleteThanks.
ReplyDeleteReally Awsome turorial! im using it, for sure!
ReplyDeleteThank you Pliskeen!
DeleteHi i like this but not working correctly please see at http://megotit.blogspot.com/
ReplyDeletewhat should i do ?
Hi friend! Go to Blogger > Layout > then click Edit on the POPULAR POST widget > check image thumbnail and uncheck snippet then SAVE. Hope this works :)
DeleteThanks for this tip!! love learning more about blogger!
ReplyDeleteTake look at Blogger Tips and Tricks
Thank you Rahul Yadav! Keep on visiting :)
DeleteHello! This doesn't really have anything to do with your code, but I was hoping you could take a look at my blog and help me figure out why there's a space in between the TITLE of the post and SNIPPET of the post on the Trending Posts widget.
ReplyDeletehttp://cheersisabelle.blogspot.kr/
Thank you in advance~!
i dont mind even if it doesnt have anything to do with my post, just leaving your comment is enough :) ok so here's what i found in your blog :
Deletehttps://www.blogger.com/static/v1/widgets/2674880080-widget_css_2_bundle.css
the URL above contains a CSS that adds a padding to .item-title, so to solve this just add :
.item-title{padding-bottom:0}
before ]]></b:skin> , that's it! i hope it solved your problem :)
Unfortunately that didn't work :( For some reason, the space only occurs when I edit the code to make the title bold and p=align left, and the snippet to p=align justify. When I remove those codes, the space disappears! How odd!
DeleteDo you know what could be the problem here? If not, thanks for trying and for being such a great resource! :)
And one more thing On mobile view this doesnt seem to be compact, so any code to make that possible? Please!!
ReplyDeleteHi Nihal Latheef! For it to happen you need to add some code to adjust it's width/s and height/s when viewing on mobile or you can set the width/s and height/s to %. Send me the link of your blog so I can help you further. :)
DeleteThanks
ReplyDeleteTipsvstricks
You're welcome! Please keep on visiting, THANK YOU :)
ReplyDelete:) Awesome Article
ReplyDelete..
http://theviralbytes.com
Thanks
ReplyDelete=)
DeleteThanks
ReplyDeleteKapitan Desain
Thanks alot.you really helped my blog http://www.gigsk.com/
ReplyDeletewhere i can see the final result of this tutorial?
ReplyDeleteYou share nice tutorial related blog, which give me some good ideas in creating my own blog, For More Popular Posts widgets you can
ReplyDeleteVisit my blog here
Thanks :)
ReplyDeleteVisit TwistBlogger