Custom Post type slider Custom Post type slider wordpress wordpress

Custom Post type slider


There is a great slider by woothemes called flexslider personally I use it on all my sites and you can use it without a plugin.Download the slider from that link i provided.

copy the flexslider.css file and jquery.flexslider-min.js file into your theme folder.

in your header.php

    <link rel="stylesheet" href="<YOUR_THEME_LINK>/flexslider.css" type="text/css">    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>    <script src="<YOUR_THEME_LINK>/jquery.flexslider-min.js"></script><script type="text/javascript">(function($) {    $(window).load(function() {        $('#slider .flexslider').flexslider({               animation: 'slide',                slideshowSpeed: 9000,                animationSpeed: 900,                pauseOnAction: true,                pauseOnHover: true,                controlNav: false,                directionNav: true,                 controlsContainer: ".flexslider",        });    });})(jQuery)</script>

in your homepage file (or anywhere you want the slider to show)

<section id="slider">      <div class="flexslider">        <ul class="slides">        <?php query_posts(array('post_type' => '<YOUR_CUSTOM_POST_TYPE>','orderby' => 'rand')); if(have_posts()) : while(have_posts()) : the_post();?>            <li class="slide">            <?php the_title(); ?>            <?php the_excerpt(); ?>            <?php the_post_thumbnail(); ?>          </li>        <?php endwhile; endif; wp_reset_query(); ?>        </ul>    </div></section>