How to put bootstrap 4 slider in wordpress

0

I'm having difficulty implementing the bootstrap 4 slider within wordpress, I created a custom post type called promocao where the highlighted image will stay on the slide. Follow my code. I've tried it in several ways. I will be very grateful if anyone can help me.

<?php get_header(); ?>
<div class="content-wrapper">
<main>
    <div id="carouselExampleFade" class="carousel slide carousel-fade" data-ride="carousel">
      <div class="carousel-inner">
            <?php 
                    $arg = array(
                    'post_type'             => 'promocao',
                    'posts_per_page'        => 5,
                    'ignore_sticky_posts'   => true,
                    );

                    $loop = new WP_Query($arg);
                    if($loop->have_posts()):
                        while($loop->have_posts()):
                            $loop->the_post();
             ?>
        <div class="carousel-item active">
            <?php the_post_thumbnail(array('class'=>'d-block w-100')); ?>
        </div>
      </div>
      <a class="carousel-control-prev" href="#carouselExampleFade" role="button" data-slide="prev">
        <span class="carousel-control-prev-icon" aria-hidden="true"></span>
        <span class="sr-only">Previous</span>
      </a>
      <a class="carousel-control-next" href="#carouselExampleFade" role="button" data-slide="next">
        <span class="carousel-control-next-icon" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
      </a>
    </div>      
        <?php
            endwhile;
            wp_reset_postdata();
            endif;
        ?>
</main>
</div>
<?php get_footer(); ?

====================================================== =========================

    
asked by anonymous 18.05.2018 / 02:12

1 answer

-2

Try this

<?php $c = 0; ?>
<div class="carousel-item <?php $c++; if($c == 1 ) { echo "active"; } ?>">
    
28.11.2018 / 22:34