Skip to main content

How To Create A Blogger Popular Posts Carousel




Stylish Popular Posts Carousel for Blogger


After reading a lot of questions regarding resizing the Popular Posts thumbnail image size, I decided to write this tutorial. But that wasn't enough. The reason for the many questions is that publishers using Blogger are searching for a better, more attractive way to display their popular posts.

I wrote the code for a blogger carousel as displayed on this blog's homepage and decided to offer it for free for download.



Customizable Date-range & Number of Sildes


The Date-range for the Popular Posts Carousel can be set to show All time posts, posts from the Last 30 days or posts from the Last 7 days.

The number of slides can be also modified to show anywhere between one and ten slides requiring only a minor code modification to adjust the number of carousel indicators.




Minimalist Carousel Controls


The Blogger Carousel can be controlled by using the left / right minimalist arrows or the minimalist carousel indicators.
Autoplay with 5 second interval and pause on hover.



Carousel Caption


The Carousel Caption contains Post Title and Post Excerpt presented on a semi-transparent black background.



Twitter Bootstrap 3


The standard Twitter Bootstrap 3 carousel element was used along with the standard bootstrap styling. You can of course use any other jQuery carousel and replace the bootstrap markup in the wodget code.




How to Implement the Carousel in your Blog


To easily follow this tutorial add the Twitter Bootstrap CSS to your blog.

Add the this line of code before the closing of your head tag:

<link href='//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' rel='stylesheet'/>


Now ad this code before the closing of your body tag:

<script src='//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'/>
<script src='//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js'/>
<script type='text/javascript'>
$(&#39;#PopularPosts2&#39;).addClass(&#39;carousel slide thumbnail&#39;).removeClass(&#39;PopularPosts widget section&#39;);
$(&#39;#homecarousel&#39;).removeClass(&#39;section&#39;);
$(function(){$(&#39;.item:first-child&#39;).addClass(&#39;active&#39;);});
$(document).ready(function() {$(&#39;.carousel&#39;).carousel({interval: 5000})});
$(document).ready(function() {$(&#39;.carouselimg&#39;).attr(&#39;src&#39;, function(i, src) {return src.replace( &#39;s72-c&#39;, &#39;s1600&#39; );});});
</script>

This bit of code is for adding the Twitter Bootstrap JavaScript and initializing the carousel.


For the last part add the Carousel code to your Blogger template where you would like the carousel to appear:


<b:section class='container' id='homecarousel' maxwidgets='1' showaddelement='no'>
<b:widget id='PopularPosts2' locked='false' title='Popular Posts' type='PopularPosts'>
<b:includable id='main'>
<ol class='carousel-indicators'>
<li class='active' data-slide-to='0' data-target='#homecarousel'/>
<li data-slide-to='1' data-target='#homecarousel'/>
<li data-slide-to='2' data-target='#homecarousel'/>
<li data-slide-to='3' data-target='#homecarousel'/>
<li data-slide-to='4' data-target='#homecarousel'/>
</ol>
<div class='carousel-inner'>
<b:loop values='data:posts' var='post'>
<div class='item'>
<b:if cond='data:post.thumbnail'>
<a expr:href='data:post.href'>
<img alt='' border='0' class='carouselimg' expr:src='data:post.thumbnail'/>
</a>
</b:if>
<div class='carousel-caption'>
<h2 class='carouseltitle'><a expr:href='data:post.href'><data:post.title/></a></h2>
<p><data:post.snippet/></p>
</div>
</div>
</b:loop>
</div>
<b:include name='quickedit'/>
<a class='left carousel-control' data-slide='prev' href='#PopularPosts2'>
<span class='icon-prev'/>
</a>
<a class='right carousel-control' data-slide='next' href='#PopularPosts2'>
<span class='icon-next'/>
</a>
</b:includable>
</b:widget>
</b:section>

Remember to change the number of carousel indicators depending on the number of slides you setup for your carousel. For setting up the number of slides click the Quick Edit button on the carousel, after adding the code above and saving your blog. As you can see in this case there are 5 indicators so when configuring the carousel either set the number of posts to 5.

Leave your questions and suggestions in the comments section below.

Comments

Popular posts from this blog

iPhone 5 Rumor Roundup

Release Date The latest rumors regarding the iPhone 5 indicate that the official release date will be officially announced during the next Apple event which is to be held on September 12th 2012. According to Verizon CFO, Fran Shammo, Apple (AAPL) will stick to last year's release date and launch the iPhone 5 in October 2012. Although during the 2012 WWDC we had the opportunity to get some more details about iOS 6, no hardware specifications were released. source - 9to5mac.com Larger Screen The iPhone 5 is rumoured to have a larger, 4 inch retina display. source - Apple.pro Nano SIM According to the Financial Times, mobile carriers in Europe are stocking up on Nano SIM cards. This might be related to the release of the next generation iPhone. Smaller Dock Connector Another wide spread rumour is that Apple will release the iPhone 5 with a smaller, 8 pin dock connector. This means that new cables will be available for  new Apple devices released in the future. Did you hear any new rum...

Single Page HTML5 CSS3 Business Card Template 2.0

After seeing a huge interest in the Single Page Business Card Tutorial  i decided to create a Single Page Business Card 2.0 Template. Besides listing your title and contact details the 2.0 template also has some nice CSS3 transition effects, is available in 4 colors and the best part: IT'S FREE FOR DOWNLOAD . Demo Download CSS3 Transition Effect On hover the Name/Title block and the Contact Details blocks slide out vertically showing a centered block containing name and position, social and contact icons. Red Template Demo Blue Template Demo Yellow Template Demo Green Template Demo

HTML Codes for Romanian Characters

Character Simple Code Numerical Code Hex Code Ă &#258; &#x102; ă &#259; &#x103; Â &Acirc; &#194; &#xC2; â &acirc; &#226; &#xE2; Î &Icirc; &#206; &#xCE; î &icirc; &#238; &#xEE; Ș &#x218; &#xDA; ș &#x219; &#xDB; Ş &#350; &#x15E; ş &#351; &#x15F; Ţ &#354; &#x162; ţ &#355; &#x163;