Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wordpress Bootstrap Carousel using a custom Post
<div id="myCarousel" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
<li data-target="#myCarousel" data-slide-to="4"></li>
</ol>
<div class="carousel-inner">
<?php query_posts('post_type=features&showposts=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="active item">
<?php the_post_thumbnail('', array('class' => 'main-home')); ?>
</div>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
<?php query_posts('post_type=features&showposts=4&offset=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="item">
<?php the_post_thumbnail('', array('class' => 'main-home')); ?>
</div>
<?php endwhile; endif; ?>
</div>
</div>
<?php wp_reset_query(); ?>
</div>
</div>
<script>
$('.carousel').carousel({
interval: 4000
})
</script>
@Dignity1988

This comment has been minimized.

Copy link

commented Sep 25, 2017

Cool i swear that i have not seen such elegance in few lines. Be the best friend of mine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.