0

I want to display 8 posts in twoeach carousel slides, that mean 4 post in each slide. i'm using a loop to display post but the problem is, it is showing one post in one slide and hence displaying 8 slides.

<div class="carousel-inner">
    <?php  
        query_posts("posts_per_page=8&post_type=post&category_name=Hector");
            if ( have_posts() ) :
                $i = 1;
                while ( have_posts() ) : the_post();
    ?>
                    <div class="carousel-item <?php if ( $i == 1 ){ echo 'active'; } ?>">
                        <div class="col-md-3">
                            <a href="http://umimpex.com/type/premium-salon-chairs/">
                                <img src="<?php the_post_thumbnail_url(); ?>"alt="<?php  the_title() . ' feature image'; ?>" style="max-width:100%;">
                                            <h3><?php  the_title(); ?></h3>
                            </a>
                        </div>  
    <?php
                        if($i % 4 == 0):
    ?>           
                    </div>
    <?php
                    endif;
                    $i++;
                endwhile;
            endif;
    ?>
</div>
  • you need to tell us more about the carousel structure i.e., which div should be repeated in a single slider. That will help us Thanks – maverick Oct 16 at 6:33
  • @maverick i want to repeat "col-md-3" div in single slide – karuna Oct 16 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.