• Hi! I’m developing my own theme for a project in school where I’m creating a site for a company. To keep it simple for them, I want to add an image-slider on the static front page through custom post type. Has anyone got a good tutorial for this? I’d rather not use a plugin!

    And I have been looking for a few hours myself 🙂

    Sincerely
    Sebastian

Viewing 2 replies - 1 through 2 (of 2 total)
  • You could use something like Flexslider with a custom post type. I haven’t been able to find a tutorial that shows exactly how to do it, but basically you:

    1. Make a Page Template for your site home page;
    2. Enqueue Flexslider for that page template only (so you’re not loading the extra javascript on every page when it’s not needed;
    3. Call the Flexslider function on your new page template, using WordPressy jQuery like so:

    <script type="text/javascript" language="javascript">
        jQuery(document).ready(function($) {
           $('.flexslider').flexslider({
                animation: "slide",
                controlNav: "thumbnails",
                pauseOnAction: "true",
                prevText: "",
                nextText: ""
              });
        });
    </script>

    4. Run a custom WP_Query loop for your custom post type, which you’ll use for your Flexslider – something like this:

    $args=array(
        'post_type' => 'home_feature',
        'post_status' => 'publish',
        'posts_per_page' => 5,
        'orderby' => 'rand',
    );
    
    $home_feature_query = new WP_Query($args);
    
    while ($home_feature_query->have_posts()) : $home_feature_query->the_post();
    
       // your slides here
    
    endwhile;

    If you don’t like Flexslider you could also try Layerslider or one of the other free jQuery slider plugins – there are a ton of ’em out there. 🙂

    Good luck with it!

    sorry mate.. iam new to wordpress 🙂 do you have any idea of video tutorial?? sorry for that 🙁

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Responsive, Custom Post Type slider’ is closed to new replies.