Hi I have been working on a carousel to display four posts inside a “slide”,

here is the code:

<div id="blogslide" class="carousel slide carousel-sync" data-ride="carousel" >
        <div class="carousel-inner wines blog1">
$args = array( 'numberposts' => -1);
$posts= get_posts( $args );
if ($posts) {
    foreach ( $posts as $post ) {
  <ol class="carousel-indicators">
    <?php while(have_posts()): the_post(); ?>
    <li data-target="#blogslide" data-slide-to="<?php echo $post->ID;?>"></li>
    <?php endwhile; ?>
<?php foreach($posts as $post) :?>
        <div class="item" id="<?php echo $post->ID;?>" >
            <div class="col-md-6 nopadding view view-ninth" style="">
                            <?php the_post_thumbnail('large'); ?>
                            <div class="content">
                                                    <h2><?php the_title(); ;?></h2>
                            <p><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,15) . '...'; ?></p>
                            <a href="<?php the_permalink() ?>" class="info">Read More >></a>
             </div><!-- end item -->         <?php endforeach; ?>
<?php wp_reset_query() ?>

To get it to display four items on the first slide i did this:


this works fine for first two slides, I then start to loose on post at a time until we only have one displaying.

What I would like to know is how to have it at four every time and also as you saw in the code I tried to get the indicators to work also but with no joy.

Thank you.

Read more here: Custom WordPress Bootstrap Carousel issue


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: