When First Item is active then Use that code

<?php

global $post;

$args = array( 'numberposts' => -1, 'category' => 3 );

$posts = get_posts( $args );

$i=0;

foreach( $posts as $post ): setup_postdata($post);

$url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'thumbnail') );

?>

   <div class="item <?php if($i==0) { ?> active <?php } else { } ?>"  style="background-image: url('<?php echo $url ?>')" >

                    <div class="carousel-caption">

                        <div class="animated bounceInRight">

                            <h2><?php the_title(); ?></h2>

                            <p><?php the_content(); ?></p>

                        </div>

                    </div>

                </div>        

             <?php $i++; endforeach; ?>

                </div>

Comments

Popular posts from this blog

Get Post Data From Simple Post custom shortcode

Top 20 Beautiful Pen For Writing

Fatal error: Maximum execution time of 300 seconds exceeded in C:\xampp\phpMyAdmin\libraries\classes\Dbi\DbiMysqli.php on line 199