A featured post slideshow is many times a good way to show your latest posts or posts from your favorite category. I always wished to add a featured slideshow to Thesis theme and searched for a number of tutorials. But most of them used bulky gallery plugins which was not my choice.
I wanted to add a custom slider which was fast and light. Since, I am not a php expert it took me some time to figure out a code for slider. And finally I was successful in doing that. Here’s the piece of code which I added to custom_functions.php and custom.css
How to setup the featured slideshow:
1. Add the following code to custom_functions.php
This code will add featured-slideshow box before the content using thesis_hook_before_content hook. And add a javascript after the footer using thesis_hook_after_html hook.
/* slide show */
function flockpost_slideshow() {
$fp = new WP_Query(array('orderby'=>'date','order'=>'DESC','showposts'=>'5'));
if ($fp->have_posts()) :
?>
<!-- Featured Slideshow -->
<div class="featured clearfix">
<div id="controls"> <!-- adding prev. and next controls to the slideshow -->
<a href="" class="prev"><?php _e('Prev', 'flockpost') ?></a>
<a href="" class="next"><?php _e('Next', 'flockpost') ?></a>
</div>
<div id="featured-slideshow">
<?php $count = 0; global $post; //variable declaration ?>
<?php
if (function_exists('dsq_loop_end')) remove_action('loop_end', 'dsq_loop_end'); // remove DISQUS action hook ?>
<?php while ($fp->have_posts()) : $fp->the_post();$do_not_duplicate = $post->ID;$image = get_post_meta($post->ID, 'thesis_post_image', $single = true); ?>
<div <?php if ($count != 0) echo 'style="display: none"'; ?>>
<a class="featured-article" href="<?php the_permalink(); ?>" rel="bookmark">
<!-- use post image for slideshow -->
<?php echo '<img src="http://flockpost.com/wp-content/themes/aromatry/lib/scripts/thumb.php?src='.$image.'&w=615&h=250&zc=1&q=100">'; ?>
<span class="featured-entry">
<span class="entry-title"><?php the_title(); ?></span>
<span class="entry-excerpt"><?php the_excerpt(); ?></span>
<span class="progress"></span>
</span>
</a>
</div>
<?php $count++; endwhile; ?>
<?php if (function_exists('dsq_loop_end')) add_action('loop_end', 'dsq_loop_end'); // add it back for other queries to use ?>
</div>
</div>
<?php endif; ?>
<?php
}
add_action('thesis_hook_before_content', 'flockpost_slideshow');
function flockpost_slideshow_js() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
<?php if (is_home() || is_front_page()) : ?>
$('#featured-slideshow').cycle({
fx: 'fade',
speed: 250,
next: '#controls .next',
prev: '#controls .prev',
timeout: 6000,
delay: -6000,
speed: 600,
pause: 1
});
<?php endif ?>
});
</script>
<?php }
add_action('thesis_hook_after_html', 'flockpost_slideshow_js'); //insert javascript at the bottom to reduce loading time of page.
/* end slide show */
/* featured slideshow */
.featured { margin: 0 10px 20px 0; overflow: hidden; }
#controls { position: relative; float: left; z-index: 100; top: 90px; }
#controls .next, #controls .prev { text-indent: -9000px; width: 30px; height: 30px; display: block; z-index: 1000; opacity: 0.7; }
#controls .prev { background: url(../custom/images/prev.png) no-repeat; float: left; position: absolute; left: 10px; }
#controls .next { background: url(../custom/images/next.png) no-repeat; float: right; position: absolute; left: 580px; }
#controls .next:hover, #controls .prev:hover { opacity: 1; }
#controls a:focus { outline: none; }
#featured-slideshow { position: relative; z-index: 0 !important; border: 5px solid #CCC; width:615px; height:250px; }
.featured-article { display: block; width: 615px; height: 250px; text-decoration: none !important; background-position: center !important; }
.featured-article img { width: 615px; height: 250px; }
.featured-entry { position: relative; top: -85px; overflow: hidden; background: #000; height: 85px; color: #a7a7a7; padding: 0; display: block; opacity: 0.8; filter: alpha(opacity = 80); }
.featured-entry .entry-title { color: #FFF; padding: 10px 15px 5px; display: block; font-size: 18px; font-weight: 700; }
.featured-entry .entry-excerpt { padding: 0 15px; margin: 0; display: block; }
3. Add this javascript to “Home Page Options” in Thesis “Page Options”
<script type="text/javascript">
(function(i){var l="2.73";if(i.support==undefined){i.support={opacity:!(i.browser.msie)}}function a(q){if(i.fn.cycle.debug){f(q)}}function f(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "))}}i.fn.cycle=function(r,q){var s={s:this.selector,c:this.context};if(this.length===0&&r!="stop"){if(!i.isReady&&s.s){f("DOM not ready, queuing slideshow");i(function(){i(s.s,s.c).cycle(r,q)});return this}f("terminating; zero elements found by selector"+(i.isReady?"":" (DOM not ready)"));return this}return this.each(function(){var w=m(this,r,q);if(w===false){return}if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=this.cyclePause=0;var x=i(this);var y=w.slideExpr?i(w.slideExpr,this):x.children();var u=y.get();if(u.length<2){f("terminating; too few slides: "+u.length);return}var t=k(x,y,u,w,s);if(t===false){return}var v=t.continuous?10:h(t.currSlide,t.nextSlide,t,!t.rev);if(v){v+=(t.delay||0);if(v<10){v=10}a("first timeout: "+v);this.cycleTimeout=setTimeout(function(){e(u,t,0,!t.rev)},v)}})};function m(q,t,r){if(q.cycleStop==undefined){q.cycleStop=0}if(t===undefined||t===null){t={}}if(t.constructor==String){switch(t){case"stop":q.cycleStop++;if(q.cycleTimeout){clearTimeout(q.cycleTimeout)}q.cycleTimeout=0;i(q).removeData("cycle.opts");return false;case"pause":q.cyclePause=1;return false;case"resume":q.cyclePause=0;if(r===true){t=i(q).data("cycle.opts");if(!t){f("options not found, can not resume");return false}if(q.cycleTimeout){clearTimeout(q.cycleTimeout);q.cycleTimeout=0}e(t.elements,t,1,1)}return false;case"prev":case"next":var u=i(q).data("cycle.opts");if(!u){f('options not found, "prev/next" ignored');return false}i.fn.cycle[t](u);return false;default:t={fx:t}}return t}else{if(t.constructor==Number){var s=t;t=i(q).data("cycle.opts");if(!t){f("options not found, can not advance slide");return false}if(s<0||s>=t.elements.length){f("invalid slide index: "+s);return false}t.nextSlide=s;if(q.cycleTimeout){clearTimeout(q.cycleTimeout);q.cycleTimeout=0}if(typeof r=="string"){t.oneTimeFx=r}e(t.elements,t,1,s>=t.currSlide);return false}}return t}function b(q,r){if(!i.support.opacity&&r.cleartype&&q.style.filter){try{q.style.removeAttribute("filter")}catch(s){}}}function k(y,J,u,t,E){var C=i.extend({},i.fn.cycle.defaults,t||{},i.metadata?y.metadata():i.meta?y.data():{});if(C.autostop){C.countdown=C.autostopCount||u.length}var r=y[0];y.data("cycle.opts",C);C.$cont=y;C.stopCount=r.cycleStop;C.elements=u;C.before=C.before?[C.before]:[];C.after=C.after?[C.after]:[];C.after.unshift(function(){C.busy=0});if(!i.support.opacity&&C.cleartype){C.after.push(function(){b(this,C)})}if(C.continuous){C.after.push(function(){e(u,C,0,!C.rev)})}n(C);if(!i.support.opacity&&C.cleartype&&!C.cleartypeNoBg){g(J)}if(y.css("position")=="static"){y.css("position","relative")}if(C.width){y.width(C.width)}if(C.height&&C.height!="auto"){y.height(C.height)}if(C.startingSlide){C.startingSlide=parseInt(C.startingSlide)}if(C.random){C.randomMap=[];for(var H=0;H<u.length;H++){C.randomMap.push(H)}C.randomMap.sort(function(L,w){return Math.random()-0.5});C.randomIndex=0;C.startingSlide=C.randomMap[0]}else{if(C.startingSlide>=u.length){C.startingSlide=0}}C.currSlide=C.startingSlide=C.startingSlide||0;var x=C.startingSlide;J.css({position:"absolute",top:0,left:0}).hide().each(function(w){var L=x?w>=x?u.length-(w-x):x-w:u.length-w;i(this).css("z-index",L)});i(u[x]).css("opacity",1).show();b(u[x],C);if(C.fit&&C.width){J.width(C.width)}if(C.fit&&C.height&&C.height!="auto"){J.height(C.height)}var D=C.containerResize&&!y.innerHeight();if(D){var v=0,B=0;for(var F=0;F<u.length;F++){var q=i(u[F]),K=q[0],A=q.outerWidth(),I=q.outerHeight();if(!A){A=K.offsetWidth}if(!I){I=K.offsetHeight}v=A>v?A:v;B=I>B?I:B}if(v>0&&B>0){y.css({width:v+"px",height:B+"px"})}}if(C.pause){y.hover(function(){this.cyclePause++},function(){this.cyclePause--})}if(c(C)===false){return false}var s=false;t.requeueAttempts=t.requeueAttempts||0;J.each(function(){var N=i(this);this.cycleH=(C.fit&&C.height)?C.height:N.height();this.cycleW=(C.fit&&C.width)?C.width:N.width();if(N.is("img")){var L=(i.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var O=(i.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var M=(i.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var w=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(L||O||M||w){if(E.s&&C.requeueOnImageNotLoaded&&++t.requeueAttempts<100){f(t.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){i(E.s,E.c).cycle(t)},C.requeueTimeout);s=true;return false}else{f("could not determine size of image: "+this.src,this.cycleW,this.cycleH)}}}return true});if(s){return false}C.cssBefore=C.cssBefore||{};C.animIn=C.animIn||{};C.animOut=C.animOut||{};J.not(":eq("+x+")").css(C.cssBefore);if(C.cssFirst){i(J[x]).css(C.cssFirst)}if(C.timeout){C.timeout=parseInt(C.timeout);if(C.speed.constructor==String){C.speed=i.fx.speeds[C.speed]||parseInt(C.speed)}if(!C.sync){C.speed=C.speed/2}while((C.timeout-C.speed)<250){C.timeout+=C.speed}}if(C.easing){C.easeIn=C.easeOut=C.easing}if(!C.speedIn){C.speedIn=C.speed}if(!C.speedOut){C.speedOut=C.speed}C.slideCount=u.length;C.currSlide=C.lastSlide=x;if(C.random){C.nextSlide=C.currSlide;if(++C.randomIndex==u.length){C.randomIndex=0}C.nextSlide=C.randomMap[C.randomIndex]}else{C.nextSlide=C.startingSlide>=(u.length-1)?0:C.startingSlide+1}if(!C.multiFx){var G=i.fn.cycle.transitions[C.fx];if(i.isFunction(G)){G(y,J,C)}else{if(C.fx!="custom"&&!C.multiFx){f("unknown transition: "+C.fx,"; slideshow terminating");return false}}}var z=J[x];if(C.before.length){C.before[0].apply(z,[z,z,C,true])}if(C.after.length>1){C.after[1].apply(z,[z,z,C,true])}if(C.next){i(C.next).bind(C.prevNextEvent,function(){return o(C,C.rev?-1:1)})}if(C.prev){i(C.prev).bind(C.prevNextEvent,function(){return o(C,C.rev?1:-1)})}if(C.pager){d(u,C)}j(C,u);return C}function n(q){q.original={before:[],after:[]};q.original.cssBefore=i.extend({},q.cssBefore);q.original.cssAfter=i.extend({},q.cssAfter);q.original.animIn=i.extend({},q.animIn);q.original.animOut=i.extend({},q.animOut);i.each(q.before,function(){q.original.before.push(this)});i.each(q.after,function(){q.original.after.push(this)})}function c(w){var u,s,r=i.fn.cycle.transitions;if(w.fx.indexOf(",")>0){w.multiFx=true;w.fxs=w.fx.replace(/\s*/g,"").split(",");for(u=0;u<w.fxs.length;u++){var v=w.fxs[u];s=r[v];if(!s||!r.hasOwnProperty(v)||!i.isFunction(s)){f("discarding unknown transition: ",v);w.fxs.splice(u,1);u--}}if(!w.fxs.length){f("No valid transitions named; slideshow terminating.");return false}}else{if(w.fx=="all"){w.multiFx=true;w.fxs=[];for(p in r){s=r[p];if(r.hasOwnProperty(p)&&i.isFunction(s)){w.fxs.push(p)}}}}if(w.multiFx&&w.randomizeEffects){var t=Math.floor(Math.random()*20)+30;for(u=0;u<t;u++){var q=Math.floor(Math.random()*w.fxs.length);w.fxs.push(w.fxs.splice(q,1)[0])}a("randomized fx sequence: ",w.fxs)}return true}function j(r,q){r.addSlide=function(u,v){var t=i(u),w=t[0];if(!r.autostopCount){r.countdown++}q[v?"unshift":"push"](w);if(r.els){r.els[v?"unshift":"push"](w)}r.slideCount=q.length;t.css("position","absolute");t[v?"prependTo":"appendTo"](r.$cont);if(v){r.currSlide++;r.nextSlide++}if(!i.support.opacity&&r.cleartype&&!r.cleartypeNoBg){g(t)}if(r.fit&&r.width){t.width(r.width)}if(r.fit&&r.height&&r.height!="auto"){$slides.height(r.height)}w.cycleH=(r.fit&&r.height)?r.height:t.height();w.cycleW=(r.fit&&r.width)?r.width:t.width();t.css(r.cssBefore);if(r.pager){i.fn.cycle.createPagerAnchor(q.length-1,w,i(r.pager),q,r)}if(i.isFunction(r.onAddSlide)){r.onAddSlide(t)}else{t.hide()}}}i.fn.cycle.resetState=function(r,q){q=q||r.fx;r.before=[];r.after=[];r.cssBefore=i.extend({},r.original.cssBefore);r.cssAfter=i.extend({},r.original.cssAfter);r.animIn=i.extend({},r.original.animIn);r.animOut=i.extend({},r.original.animOut);r.fxFn=null;i.each(r.original.before,function(){r.before.push(this)});i.each(r.original.after,function(){r.after.push(this)});var s=i.fn.cycle.transitions[q];if(i.isFunction(s)){s(r.$cont,i(r.elements),r)}};function e(x,q,w,y){if(w&&q.busy&&q.manualTrump){i(x).stop(true,true);q.busy=false}if(q.busy){return}var u=q.$cont[0],A=x[q.currSlide],z=x[q.nextSlide];if(u.cycleStop!=q.stopCount||u.cycleTimeout===0&&!w){return}if(!w&&!u.cyclePause&&((q.autostop&&(--q.countdown<=0))||(q.nowrap&&!q.random&&q.nextSlide<q.currSlide))){if(q.end){q.end(q)}return}if(w||!u.cyclePause){var v=q.fx;A.cycleH=A.cycleH||i(A).height();A.cycleW=A.cycleW||i(A).width();z.cycleH=z.cycleH||i(z).height();z.cycleW=z.cycleW||i(z).width();if(q.multiFx){if(q.lastFx==undefined||++q.lastFx>=q.fxs.length){q.lastFx=0}v=q.fxs[q.lastFx];q.currFx=v}if(q.oneTimeFx){v=q.oneTimeFx;q.oneTimeFx=null}i.fn.cycle.resetState(q,v);if(q.before.length){i.each(q.before,function(B,C){if(u.cycleStop!=q.stopCount){return}C.apply(z,[A,z,q,y])})}var s=function(){i.each(q.after,function(B,C){if(u.cycleStop!=q.stopCount){return}C.apply(z,[A,z,q,y])})};if(q.nextSlide!=q.currSlide){q.busy=1;if(q.fxFn){q.fxFn(A,z,q,s,y)}else{if(i.isFunction(i.fn.cycle[q.fx])){i.fn.cycle[q.fx](A,z,q,s)}else{i.fn.cycle.custom(A,z,q,s,w&&q.fastOnEvent)}}}q.lastSlide=q.currSlide;if(q.random){q.currSlide=q.nextSlide;if(++q.randomIndex==x.length){q.randomIndex=0}q.nextSlide=q.randomMap[q.randomIndex]}else{var t=(q.nextSlide+1)==x.length;q.nextSlide=t?0:q.nextSlide+1;q.currSlide=t?x.length-1:q.nextSlide-1}if(q.pager){i.fn.cycle.updateActivePagerLink(q.pager,q.currSlide)}}var r=0;if(q.timeout&&!q.continuous){r=h(A,z,q,y)}else{if(q.continuous&&u.cyclePause){r=10}}if(r>0){u.cycleTimeout=setTimeout(function(){e(x,q,0,!q.rev)},r)}}i.fn.cycle.updateActivePagerLink=function(q,r){i(q).each(function(){i(this).find("a").removeClass("activeSlide").filter("a:eq("+r+")").addClass("activeSlide")})};function h(v,s,u,r){if(u.timeoutFn){var q=u.timeoutFn(v,s,u,r);while((q-u.speed)<250){q+=u.speed}a("calculated timeout: "+q+"; speed: "+u.speed);if(q!==false){return q}}return u.timeout}i.fn.cycle.next=function(q){o(q,q.rev?-1:1)};i.fn.cycle.prev=function(q){o(q,q.rev?1:-1)};function o(r,u){var q=r.elements;var t=r.$cont[0],s=t.cycleTimeout;if(s){clearTimeout(s);t.cycleTimeout=0}if(r.random&&u<0){r.randomIndex--;if(--r.randomIndex==-2){r.randomIndex=q.length-2}else{if(r.randomIndex==-1){r.randomIndex=q.length-1}}r.nextSlide=r.randomMap[r.randomIndex]}else{if(r.random){if(++r.randomIndex==q.length){r.randomIndex=0}r.nextSlide=r.randomMap[r.randomIndex]}else{r.nextSlide=r.currSlide+u;if(r.nextSlide<0){if(r.nowrap){return false}r.nextSlide=q.length-1}else{if(r.nextSlide>=q.length){if(r.nowrap){return false}r.nextSlide=0}}}}if(i.isFunction(r.prevNextClick)){r.prevNextClick(u>0,r.nextSlide,q[r.nextSlide])}e(q,r,1,u>=0);return false}function d(r,s){var q=i(s.pager);i.each(r,function(t,u){i.fn.cycle.createPagerAnchor(t,u,q,r,s)});i.fn.cycle.updateActivePagerLink(s.pager,s.startingSlide)}i.fn.cycle.createPagerAnchor=function(u,v,s,t,w){var r;if(i.isFunction(w.pagerAnchorBuilder)){r=w.pagerAnchorBuilder(u,v)}else{r='<a href="#">'+(u+1)+"</a>"}if(!r){return}var x=i(r);if(x.parents("body").length===0){var q=[];if(s.length>1){s.each(function(){var y=x.clone(true);i(this).append(y);q.push(y[0])});x=i(q)}else{x.appendTo(s)}}x.bind(w.pagerEvent,function(A){A.preventDefault();w.nextSlide=u;var z=w.$cont[0],y=z.cycleTimeout;if(y){clearTimeout(y);z.cycleTimeout=0}if(i.isFunction(w.pagerClick)){w.pagerClick(w.nextSlide,t[w.nextSlide])}e(t,w,1,w.currSlide<u);return false});if(w.pagerEvent!="click"){x.click(function(){return false})}if(w.pauseOnPagerHover){x.hover(function(){w.$cont[0].cyclePause++},function(){w.$cont[0].cyclePause--})}};i.fn.cycle.hopsFromLast=function(t,s){var r,q=t.lastSlide,u=t.currSlide;if(s){r=u>q?u-q:t.slideCount-q}else{r=u<q?q-u:q+t.slideCount-u}return r};function g(s){function r(t){t=parseInt(t).toString(16);return t.length<2?"0"+t:t}function q(w){for(;w&&w.nodeName.toLowerCase()!="html";w=w.parentNode){var t=i.css(w,"background-color");if(t.indexOf("rgb")>=0){var u=t.match(/\d+/g);return"#"+r(u[0])+r(u[1])+r(u[2])}if(t&&t!="transparent"){return t}}return"#ffffff"}s.each(function(){i(this).css("background-color",q(this))})}i.fn.cycle.commonReset=function(v,t,u,r,s,q){i(u.elements).not(v).hide();u.cssBefore.opacity=1;u.cssBefore.display="block";if(r!==false&&t.cycleW>0){u.cssBefore.width=t.cycleW}if(s!==false&&t.cycleH>0){u.cssBefore.height=t.cycleH}u.cssAfter=u.cssAfter||{};u.cssAfter.display="none";i(v).css("zIndex",u.slideCount+(q===true?1:0));i(t).css("zIndex",u.slideCount+(q===true?0:1))};i.fn.cycle.custom=function(B,v,q,s,r){var A=i(B),w=i(v);var t=q.speedIn,z=q.speedOut,u=q.easeIn,y=q.easeOut;w.css(q.cssBefore);if(r){if(typeof r=="number"){t=z=r}else{t=z=1}u=y=null}var x=function(){w.animate(q.animIn,t,u,s)};A.animate(q.animOut,z,y,function(){if(q.cssAfter){A.css(q.cssAfter)}if(!q.sync){x()}});if(q.sync){x()}};i.fn.cycle.transitions={fade:function(r,s,q){s.not(":eq("+q.currSlide+")").css("opacity",0);q.before.push(function(v,t,u){i.fn.cycle.commonReset(v,t,u);u.cssBefore.opacity=0});q.animIn={opacity:1};q.animOut={opacity:0};q.cssBefore={top:0,left:0}}};i.fn.cycle.ver=function(){return l};i.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,prevNextClick:null,prevNextEvent:"click",pager:null,pagerClick:null,pagerEvent:"click",pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!i.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250}})(jQuery);</script>
<script type="text/javascript">
jQuery.fn.equalHeights=function(px){jQuery(this).each(function(){var currentTallest=0;jQuery(this).children().each(function(i){if(jQuery(this).height()>currentTallest){currentTallest=jQuery(this).height();}});if(!px||!Number.prototype.pxToEm)currentTallest=currentTallest.pxToEm();
jQuery(this).children().css({'height':currentTallest});});return this;};
Number.prototype.pxToEm=String.prototype.pxToEm=function(settings){settings=jQuery.extend({scope:'body',reverse:false},settings);var pxVal=(this=='')?0:parseFloat(this);var scopeVal;var getWindowWidth=function(){var de=document.documentElement;return self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;};if(settings.scope=='body'&&jQuery.browser.msie&&(parseFloat(jQuery('body').css('font-size'))/getWindowWidth()).toFixed(1)>0.0){var calcFontSize=function(){return(parseFloat(jQuery('body').css('font-size'))/getWindowWidth()).toFixed(3)*16;};scopeVal=calcFontSize();}
else{scopeVal=parseFloat(jQuery(settings.scope).css("font-size"));};var result=(settings.reverse==true)?(pxVal*scopeVal).toFixed(2)+'px':(pxVal/scopeVal).toFixed(2)+'em';return result;};</script>
<script type="text/javascript">
eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([47-9yA-Z]|[12]\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(4(j){8 u="2.30";8 t=j.21.22&&/MSIE 6.0/.1t(navigator.userAgent);4 r(){7(23.24&&23.24.2p){23.24.2p("[D] "+Array.prototype.join.call(2q,""))}}j.G.D=4(l){8 s=2q[1];Q A.1r(4(){7(l===undefined||l===R){l={}}7(l.25==2r){switch(l){26"stop":7(A.U){1u(A.U)}A.U=0;j(A).1C("D.1K","");Q;26"27":A.1h=1;Q;26"2s":A.1h=0;7(s===28){l=j(A).1C("D.1K");7(!l){r("2t 1n 2u, 2v 1n 2s");Q}7(A.U){1u(A.U);A.U=0}q(l.1L,l,1,1)}Q;default:l={fx:l}}}S{7(l.25==Number){8 i=l;l=j(A).1C("D.1K");7(!l){r("2t 1n 2u, 2v 1n advance 2w");Q}7(i<0||i>=l.1L.N){r("invalid 2w 1D: "+i);Q}l.P=i;7(A.U){1u(A.U);A.U=0}q(l.1L,l,1,i>=l.1b);Q}}7(A.U){1u(A.U)}A.U=0;A.1h=0;8 b=j(A);8 g=l.29?j(l.29,A):b.children();8 k=g.get();7(k.N<2){r("terminating; too few slides: "+k.N);Q}8 a=j.extend({},j.G.D.2x,l||{},j.2y?b.2y():j.meta?b.1C():{});7(a.2a){a.2b=a.2c||k.N}b.1C("D.1K",a);a.1v=A;a.1L=k;a.J=a.J?[a.J]:[];a.1k=a.1k?[a.1k]:[];a.1k.1M(4(){a.2d=0});7(a.1w){a.1k.L(4(){q(k,a,0,!a.1x)})}7(t&&a.1N&&!a.2z){h(g)}8 o=A.className;a.F=V((o.1E(/w:(\\d+)/)||[])[1])||a.F;a.E=V((o.1E(/h:(\\d+)/)||[])[1])||a.E;a.1c=V((o.1E(/t:(\\d+)/)||[])[1])||a.1c;7(b.y("1O")=="static"){b.y("1O","relative")}7(a.F){b.F(a.F)}7(a.E&&a.E!="1P"){b.E(a.E)}7(a.19){a.19=V(a.19)}7(a.1l){a.1p=[];1F(8 n=0;n<k.N;n++){a.1p.L(n)}a.1p.sort(4(e,f){Q Math.1l()-0.5});a.11=0;a.19=a.1p[0]}S{7(a.19>=k.N){a.19=0}}8 m=a.19||0;g.y({1O:"2A",B:0,9:0}).W().1r(4(e){8 f=m?e>=m?k.N-(e-m):m-e:k.N-e;j(A).y("z-1D",f)});j(k[m]).y("1i",1).X();7(j.21.22){k[m].2B.2C("2e")}7(a.1m&&a.F){g.F(a.F)}7(a.1m&&a.E&&a.E!="1P"){g.E(a.E)}7(a.27){b.2D(4(){A.1h=1},4(){A.1h=0})}8 v=j.G.D.O[a.fx];7(j.2E(v)){v(b,g,a)}S{7(a.fx!="2f"){r("unknown transition: "+a.fx)}}g.1r(4(){8 e=j(A);A.12=(a.1m&&a.E)?a.E:e.E();A.14=(a.1m&&a.F)?a.F:e.F()});a.C=a.C||{};a.K=a.K||{};a.I=a.I||{};g.1n(":eq("+m+")").y(a.C);7(a.1g){j(g[m]).y(a.1g)}7(a.1c){a.1c=V(a.1c);7(a.1a.25==2r){a.1a=j.fx.speeds[a.1a]||V(a.1a)}7(!a.1Q){a.1a=a.1a/2}while((a.1c-a.1a)<250){a.1c+=a.1a}}7(a.2h){a.1R=a.1S=a.2h}7(!a.1y){a.1y=a.1a}7(!a.1G){a.1G=a.1a}a.2F=k.N;a.1b=m;7(a.1l){a.P=a.1b;7(++a.11==k.N){a.11=0}a.P=a.1p[a.11]}S{a.P=a.19>=(k.N-1)?0:a.19+1}8 p=g[m];7(a.J.N){a.J[0].1T(p,[p,p,a,28])}7(a.1k.N>1){a.1k[1].1T(p,[p,p,a,28])}7(a.1H&&!a.1I){a.1I=a.1H}7(a.1I){j(a.1I).2i("1H",4(){Q w(k,a,a.1x?-1:1)})}7(a.2j){j(a.2j).2i("1H",4(){Q w(k,a,a.1x?1:-1)})}7(a.1q){x(k,a)}a.addSlide=4(e,f){8 c=j(e),d=c[0];7(!a.2c){a.2b++}k[f?"1M":"L"](d);7(a.1d){a.1d[f?"1M":"L"](d)}a.2F=k.N;c.y("1O","2A");c[f?"prependTo":"2G"](b);7(f){a.1b++;a.P++}7(t&&a.1N&&!a.2z){h(c)}7(a.1m&&a.F){c.F(a.F)}7(a.1m&&a.E&&a.E!="1P"){g.E(a.E)}d.12=(a.1m&&a.E)?a.E:c.E();d.14=(a.1m&&a.F)?a.F:c.F();c.y(a.C);7(a.1q){j.G.D.2k(k.N-1,d,j(a.1q),k,a)}7(1U a.Y=="4"){a.Y(c)}};7(a.1c||a.1w){A.U=1V(4(){q(k,a,0,!a.1x)},a.1w?10:a.1c+(a.2H||0))}})};4 q(c,d,i,b){7(d.2d){Q}8 g=d.1v,k=c[d.1b],a=c[d.P];7(g.U===0&&!i){Q}7(!i&&!g.1h&&((d.2a&&(--d.2b<=0))||(d.1W&&!d.1l&&d.P<d.1b))){7(d.2l){d.2l(d)}Q}7(i||!g.1h){7(d.J.N){j.1r(d.J,4(e,f){f.1T(a,[k,a,d,b])})}8 o=4(){7(j.21.22&&d.1N){A.2B.2C("2e")}j.1r(d.1k,4(e,f){f.1T(a,[k,a,d,b])})};7(d.P!=d.1b){d.2d=1;7(d.1X){d.1X(k,a,d,o,b)}S{7(j.2E(j.G.D[d.fx])){j.G.D[d.fx](k,a,d,o)}S{j.G.D.2f(k,a,d,o,i&&d.2I)}}}7(d.1l){d.1b=d.P;7(++d.11==c.N){d.11=0}d.P=d.1p[d.11]}S{8 n=(d.P+1)==c.N;d.P=n?0:d.P+1;d.1b=n?c.N-1:d.P-1}7(d.1q){j.G.D.2m(d.1q,d.1b)}}7(d.1c&&!d.1w){g.U=1V(4(){q(c,d,0,!d.1x)},d.1c)}S{7(d.1w&&g.1h){g.U=1V(4(){q(c,d,0,!d.1x)},10)}}}j.G.D.2m=4(e,f){j(e).find("a").removeClass("2J").2e("a:eq("+f+")").addClass("2J")};4 w(e,f,c){8 d=f.1v,i=d.U;7(i){1u(i);d.U=0}7(f.1l&&c<0){f.11--;7(--f.11==-2){f.11=e.N-2}S{7(f.11==-1){f.11=e.N-1}}f.P=f.1p[f.11]}S{7(f.1l){7(++f.11==e.N){f.11=0}f.P=f.1p[f.11]}S{f.P=f.1b+c;7(f.P<0){7(f.1W){Q 1Y}f.P=e.N-1}S{7(f.P>=e.N){7(f.1W){Q 1Y}f.P=0}}}}7(f.1Z&&1U f.1Z=="4"){f.1Z(c>0,f.P,e[f.P])}q(e,f,1,c>=0);Q 1Y}4 x(c,d){8 i=j(d.1q);j.1r(c,4(e,f){j.G.D.2k(e,f,i,c,d)});j.G.D.2m(d.1q,d.19)}j.G.D.2k=4(c,d,i,b,g){8 k=(1U g.2n=="4")?j(g.2n(c,d)):j(\'<a href="#">\'+(c+1)+"</a>");7(k.parents("body").N==0){k.2G(i)}k.2i(g.2K,4(){g.P=c;8 e=g.1v,f=e.U;7(f){1u(f);e.U=0}7(1U g.2o=="4"){g.2o(g.P,b[g.P])}q(b,g,1,g.1b<c);Q 1Y});7(g.2L){k.2D(4(){g.1v.1h=1},4(){g.1v.1h=0})}};4 h(d){4 i(e){8 e=V(e).toString(16);Q e.N<2?"0"+e:e}4 b(e){1F(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){8 f=j.y(e,"2M-2N");7(f.indexOf("rgb")>=0){8 c=f.1E(/\\d+/g);Q"#"+i(c[0])+i(c[1])+i(c[2])}7(f&&f!="transparent"){Q f}}Q"#ffffff"}d.1r(4(){j(A).y("2M-2N",b(A))})}j.G.D.2f=4(e,f,c,d,i){8 b=j(e),g=j(f);g.y(c.C);8 k=i?1:c.1y;8 a=i?1:c.1G;8 o=i?R:c.1R;8 n=i?R:c.1S;8 m=4(){g.20(c.K,k,o,d)};b.20(c.I,a,n,4(){7(c.M){b.y(c.M)}7(!c.1Q){m()}});7(c.1Q){m()}};j.G.D.O={2O:4(f,c,d){c.1n(":eq("+d.19+")").y("1i",0);d.J.L(4(){j(A).X()});d.K={1i:1};d.I={1i:0};d.C={1i:0};d.M={T:"Z"};d.Y=4(e){e.W()}}};j.G.D.ver=4(){Q u};j.G.D.2x={fx:"2O",1c:4000,1w:0,1a:1000,1y:R,1G:R,1I:R,2j:R,1Z:R,1q:R,2o:R,2K:"1H",2n:R,J:R,1k:R,2l:R,2h:R,1R:R,1S:R,1J:R,K:R,I:R,C:R,M:R,1X:R,E:"1P",19:0,1Q:1,1l:0,1m:0,27:0,2L:0,2a:0,2c:0,2H:0,29:R,1N:0,1W:0,2I:0}})(2P);(4(h){h.G.D.O.scrollUp=4(d,i,b){d.y("18","1e");b.J.L(4(e,f,c){h(A).X();c.C.B=f.1z;c.I.B=0-e.1z});b.1g={B:0};b.K={B:0};b.M={T:"Z"}};h.G.D.O.scrollDown=4(d,i,b){d.y("18","1e");b.J.L(4(e,f,c){h(A).X();c.C.B=0-f.1z;c.I.B=e.1z});b.1g={B:0};b.K={B:0};b.M={T:"Z"}};h.G.D.O.scrollLeft=4(d,i,b){d.y("18","1e");b.J.L(4(e,f,c){h(A).X();c.C.9=f.1A;c.I.9=0-e.1A});b.1g={9:0};b.K={9:0}};h.G.D.O.scrollRight=4(d,i,b){d.y("18","1e");b.J.L(4(e,f,c){h(A).X();c.C.9=0-f.1A;c.I.9=e.1A});b.1g={9:0};b.K={9:0}};h.G.D.O.scrollHorz=4(g,k,a){g.y("18","1e").F();a.J.L(4(e,f,c,d){h(A).X();8 i=e.1A,b=f.1A;c.C=d?{9:b}:{9:-b};c.K.9=0;c.I.9=d?-i:i;k.1n(e).y(c.C)});a.1g={9:0};a.M={T:"Z"}};h.G.D.O.scrollVert=4(g,k,a){g.y("18","1e");a.J.L(4(e,f,c,d){h(A).X();8 i=e.1z,b=f.1z;c.C=d?{B:-b}:{B:b};c.K.B=0;c.I.B=d?i:-i;k.1n(e).y(c.C)});a.1g={B:0};a.M={T:"Z"}};h.G.D.O.slideX=4(d,i,b){b.J.L(4(e,f,c){h(e).y("H",1)});b.Y=4(e){e.W()};b.C={H:2};b.K={F:"X"};b.I={F:"W"}};h.G.D.O.slideY=4(d,i,b){b.J.L(4(e,f,c){h(e).y("H",1)});b.Y=4(e){e.W()};b.C={H:2};b.K={E:"X"};b.I={E:"W"}};h.G.D.O.1J=4(o,n,m){8 v=o.y("18","2Q").F();n.y({9:0,B:0});m.J.L(4(){h(A).X()});m.1a=m.1a/2;m.1l=0;m.1J=m.1J||{9:-v,B:15};m.1d=[];1F(8 p=0;p<n.N;p++){m.1d.L(n[p])}1F(8 p=0;p<m.19;p++){m.1d.L(m.1d.2R())}m.1X=4(d,i,b,g,k){8 a=k?h(d):h(i);a.20(b.1J,b.1y,b.1R,4(){k?b.1d.L(b.1d.2R()):b.1d.1M(b.1d.pop());7(k){1F(8 e=0,f=b.1d.N;e<f;e++){h(b.1d[e]).y("z-1D",f-e)}}S{8 c=h(d).y("z-1D");a.y("z-1D",V(c)+1)}a.20({9:0,B:0},b.1G,b.1S,4(){h(k?A:d).W();7(g){g()}})})};m.Y=4(e){e.W()}};h.G.D.O.turnUp=4(d,i,b){b.J.L(4(e,f,c){h(A).X();c.C.B=f.12;c.K.E=f.12});b.Y=4(e){e.W()};b.1g={B:0};b.C={E:0};b.K={B:0};b.I={E:0};b.M={T:"Z"}};h.G.D.O.turnDown=4(d,i,b){b.J.L(4(e,f,c){h(A).X();c.K.E=f.12;c.I.B=e.12});b.Y=4(e){e.W()};b.1g={B:0};b.C={B:0,E:0};b.I={E:0};b.M={T:"Z"}};h.G.D.O.turnLeft=4(d,i,b){b.J.L(4(e,f,c){h(A).X();c.C.9=f.14;c.K.F=f.14});b.Y=4(e){e.W()};b.C={F:0};b.K={9:0};b.I={F:0};b.M={T:"Z"}};h.G.D.O.turnRight=4(d,i,b){b.J.L(4(e,f,c){h(A).X();c.K.F=f.14;c.I.9=e.14});b.Y=4(e){e.W()};b.C={9:0,F:0};b.K={9:0};b.I={F:0};b.M={T:"Z"}};h.G.D.O.2S=4(d,i,b){b.1g={B:0,9:0};b.M={T:"Z"};b.J.L(4(e,f,c){h(A).X();c.C={F:0,E:0,B:f.12/2,9:f.14/2};c.M={T:"Z"};c.K={B:0,9:0,F:f.14,E:f.12};c.I={F:0,E:0,B:e.12/2,9:e.14/2};h(e).y("H",2);h(f).y("H",1)});b.Y=4(e){e.W()}};h.G.D.O.fadeZoom=4(d,i,b){b.J.L(4(e,f,c){c.C={F:0,E:0,1i:1,9:f.14/2,B:f.12/2,H:1};c.K={B:0,9:0,F:f.14,E:f.12}});b.I={1i:0};b.M={H:0}};h.G.D.O.blindX=4(d,i,b){8 g=d.y("18","1e").F();i.X();b.J.L(4(e,f,c){h(e).y("H",1)});b.C={9:g,H:2};b.M={H:1};b.K={9:0};b.I={9:g}};h.G.D.O.blindY=4(d,i,b){8 g=d.y("18","1e").E();i.X();b.J.L(4(e,f,c){h(e).y("H",1)});b.C={B:g,H:2};b.M={H:1};b.K={B:0};b.I={B:g}};h.G.D.O.blindZ=4(d,i,b){8 g=d.y("18","1e").E();8 k=d.F();i.X();b.J.L(4(e,f,c){h(e).y("H",1)});b.C={B:g,9:k,H:2};b.M={H:1};b.K={B:0,9:0};b.I={B:g,9:k}};h.G.D.O.growX=4(d,i,b){b.J.L(4(e,f,c){c.C={9:A.14/2,F:0,H:2};c.K={9:0,F:A.14};c.I={9:0};h(e).y("H",1)});b.Y=4(e){e.W().y("H",1)}};h.G.D.O.growY=4(d,i,b){b.J.L(4(e,f,c){c.C={B:A.12/2,E:0,H:2};c.K={B:0,E:A.12};c.I={B:0};h(e).y("H",1)});b.Y=4(e){e.W().y("H",1)}};h.G.D.O.curtainX=4(d,i,b){b.J.L(4(e,f,c){c.C={9:f.14/2,F:0,H:1,T:"1B"};c.K={9:0,F:A.14};c.I={9:e.14/2,F:0};h(e).y("H",2)});b.Y=4(e){e.W()};b.M={H:1,T:"Z"}};h.G.D.O.curtainY=4(d,i,b){b.J.L(4(e,f,c){c.C={B:f.12/2,E:0,H:1,T:"1B"};c.K={B:0,E:A.12};c.I={B:e.12/2,E:0};h(e).y("H",2)});b.Y=4(e){e.W()};b.M={H:1,T:"Z"}};h.G.D.O.cover=4(d,i,b){8 g=b.2T||"9";8 k=d.y("18","1e").F();8 a=d.E();b.J.L(4(e,f,c){c.C=c.C||{};c.C.H=2;c.C.T="1B";7(g=="2U"){c.C.9=-k}S{7(g=="up"){c.C.B=a}S{7(g=="2W"){c.C.B=-a}S{c.C.9=k}}}h(e).y("H",1)});7(!b.K){b.K={9:0,B:0}}7(!b.I){b.I={9:0,B:0}}b.M=b.M||{};b.M.H=2;b.M.T="Z"};h.G.D.O.uncover=4(d,i,b){8 g=b.2T||"9";8 k=d.y("18","1e").F();8 a=d.E();b.J.L(4(e,f,c){c.C.T="1B";7(g=="2U"){c.I.9=k}S{7(g=="up"){c.I.B=-a}S{7(g=="2W"){c.I.B=a}S{c.I.9=-k}}}h(e).y("H",2);h(f).y("H",1)});b.Y=4(e){e.W()};7(!b.K){b.K={9:0,B:0}}b.C=b.C||{};b.C.B=0;b.C.9=0;b.M=b.M||{};b.M.H=1;b.M.T="Z"};h.G.D.O.toss=4(d,i,b){8 g=d.y("18","2Q").F();8 k=d.E();b.J.L(4(e,f,c){h(e).y("H",2);c.C.T="1B";7(!c.I.9&&!c.I.B){c.I={9:g*2,B:-k/2,1i:0}}S{c.I.1i=0}});b.Y=4(e){e.W()};b.C={9:0,B:0,H:1,1i:1};b.K={9:0};b.M={H:2,T:"Z"}};h.G.D.O.wipe=4(v,p,l){8 s=v.y("18","1e").F();8 j=v.E();l.C=l.C||{};8 u;7(l.1j){7(/l2r/.1t(l.1j)){u="1s(1f 1f "+j+"px 1f)"}S{7(/r2l/.1t(l.1j)){u="1s(1f "+s+"px "+j+"px "+s+"px)"}S{7(/t2b/.1t(l.1j)){u="1s(1f "+s+"px 1f 1f)"}S{7(/b2t/.1t(l.1j)){u="1s("+j+"px "+s+"px "+j+"px 1f)"}S{7(/2S/.1t(l.1j)){8 t=V(j/2);8 r=V(s/2);u="1s("+t+"px "+r+"px "+t+"px "+r+"px)"}}}}}}l.C.1j=l.C.1j||u||"1s(1f 1f 1f 1f)";8 q=l.C.1j.1E(/(\\d+)/g);8 t=V(q[0]),w=V(q[1]),x=V(q[2]),r=V(q[3]);l.J.L(4(i,b,g){7(i==b){Q}8 k=h(i).y("H",2);8 a=h(b).y({H:3,T:"1B"});8 o=1,n=V((g.1y/13))-1;4 m(){8 e=t?t-V(o*(t/n)):0;8 f=r?r-V(o*(r/n)):0;8 c=x<j?x+V(o*((j-x)/n||1)):j;8 d=w<s?w+V(o*((s-w)/n||1)):s;a.y({1j:"1s("+e+"px "+d+"px "+c+"px "+f+"px)"});(o++<=n)?1V(m,13):k.y("T","Z")}m()});l.M={};l.K={9:0};l.I={9:0}}})(2P);',[],183,'||||function|||if|var|left|||||||||||||||||||||||||css||this|top|cssBefore|cycle|height|width|fn|zIndex|animOut|before|animIn|push|cssAfter|length|transitions|nextSlide|return|null|else|display|cycleTimeout|parseInt|hide|show|onAddSlide|none||randomIndex|cycleH||cycleW||||overflow|startingSlide|speed|currSlide|timeout|els|hidden|0px|cssFirst|cyclePause|opacity|clip|after|random|fit|not||randomMap|pager|each|rect|test|clearTimeout|container|continuous|rev|speedIn|offsetHeight|offsetWidth|block|data|index|match|for|speedOut|click|next|shuffle|opts|elements|unshift|cleartype|position|auto|sync|easeIn|easeOut|apply|typeof|setTimeout|nowrap|fxFn|false|prevNextClick|animate|browser|msie|window|console|constructor|case|pause|true|slideExpr|autostop|countdown|autostopCount|busy|filter|custom||easing|bind|prev|createPagerAnchor|end|updateActivePagerLink|pagerAnchorBuilder|pagerClick|log|arguments|String|resume|options|found|can|slide|defaults|metadata|cleartypeNoBg|absolute|style|removeAttribute|hover|isFunction|slideCount|appendTo|delay|fastOnEvent|activeSlide|pagerEvent|pauseOnPagerHover|background|color|fade|jQuery|visible|shift|zoom|direction|right||down'.split('|'),0,{})) </script>
4. Include jQuery library for the home page.
After doing this you need to make a few changes to the code, for the proper functioning, which are described below.
Things to be taken care of:
1. Make sure that you change the image source to your site’s thesis theme folder.
http://flockpost.com/wp-content/themes/aromatry must be changed to
http://yoursite.com/wp-comtent/themes/your_thesis_theme
In case you are using Thesis 1.7 it will be
http://yoursite.com/wp-content/themes/thesis_17
2. Size of Post Image
Since this slider uses the post image as slideshow image. You must have a large post image. A post image with a width greater than 550px and height more than 200px would be fine. The size used in slideshow is, width: 615px and height: 240px.
Additional Changes
Display posts from a particular category:
To display a post from a particular category of your choice you need to add:
‘category_name’=> ‘your-category-name’
Changing number of posts in slideshow:
If you want to change the number of posts in the slideshow, you only need to change the value of:
‘showposts’=> ‘5’ replace 5 with the custom value.
Changing the Slideshow FX:
I have used a fading effect for the slideshow. You can change it by changing the value of fx to a valid javascript fx. If you want a horizontal slider effect, change ‘fade’ to ‘scrollHorz’.
I hope that’s really quick and easy way to add a slideshow instead of using bulky plugins. If you have any queries or issues while using this code please drop in a comment. I will try to get back as soon as possible.








