Multiple Loops
-
Hello I am trying to use Bootstrap Carouse to display Testimonials on my webpage. Testimonials are made using customs post types. I have the Carouse working, however after the last testimonial, it does not go back to the start of the loop and start all over again. Below is my code. what am I doing wrong. Please Help
<section class="bg-primary page" id="testimonial"> <h2 class="text-xs-center">TESTIMONIAL</h2> <div class="separator-container"> <div class="separator line-separator">?</div> </div> <p class="text-xs-center">See what Clients are saying about our work</p> <div id="testimonial-carousel" class="carousel slide" data-ride="carousel"> <!-- Carousel Inner --> <?php $loop = new WP_Query(array('post_type' => 'testimonial' , 'orderby' => 'post_id' , 'order' => 'ASC','posts_per_page'=>'1' )); ?> <?php while ($loop ->have_posts()) : $loop->the_post(); ?> <div class="carousel-inner" role="listbox"> <div class="carousel-item active"> <div class="row"> <div class="container-fluid"> <div class="col-md-8 offset-md-2 col-xs-12"> <div class="card card-block"> <?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?> <img class="img-circle" src="<?php echo "$feat_image"?>" alt="the_post_thumbnail(alt);" /> <div class="review"> <q cite="<?php the_field('reviewer-name'); ?>"><?php the_field('review'); ?></q> </div> <hr> <div class="reviewer-info"> <h4 class="reviewer-name"><?php the_field('reviewer-name'); ?></h4> <p class="reviewer-title"> <span><?php the_field('reviewer-title');?></span> <span class="text-muted"><a class="text-muted" href="<?php the_field('reviewer-company-url'); ?>"><?php the_field('reviewer-company'); ?></a></span> </p> </div> </div> </div> </div> </div> </div> <?php endwhile; ?> <?php wp_reset_postdata(); wp_reset_query(); ?> <?php $loop = new WP_Query(array('post_type' => 'testimonial' , 'orderby' => 'post_id' , 'order' => 'ASC','offset' => '1' )); ?> <?php while ($loop ->have_posts()) : $loop->the_post(); ?> <div class="carousel-inner" role="listbox"> <div class="carousel-item "> <div class="row"> <div class="container-fluid"> <div class="col-md-8 offset-md-2 col-xs-12"> <div class="card card-block"> <?php $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?> <img class="img-circle" src="<?php echo "$feat_image"?>" alt="the_post_thumbnail(alt);" /> <div class="review"> <q cite="<?php the_field('reviewer-name'); ?>"><?php echo the_field('review'); ?></q> </div> <hr> <div class="reviewer-info"> <h4 class="reviewer-name"><?php the_field('reviewer-name'); ?></h4> <p class="reviewer-title"> <span><?php the_field('reviewer-title');?> </span> <span class="text-muted"><a class="text-muted" href="<?php the_field('reviewer-company-url'); ?>"><?php the_field('reviewer-company'); ?></a></span> </p> </div> </div> </div> </div> </div> </div> <?php endwhile;?> <?php wp_reset_postdata(); wp_reset_query(); ?> </div><!-- Carousel Inner Close --> </div> </section>
[bump moderated]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Multiple Loops’ is closed to new replies.