title: PHP if first div show class if else dont have class
body: <p>I have a bootstrap carousel which requires for the first slide to have a class of active to work. Then the jquery removes and adds the class of active as the slide changes.</p>
  
  <p>I am using wordpress to populate the carousel and using the advanced custom fields plugin to do so.</p>
  
  <p>What im looking to do is if it is the first div then add the class of active. If it is not the first div then the class is not added.</p>
  
  <p>Here is my php so far:</p>
  
  <pre><code>              &lt;div class="carousel-inner"&gt;
              &lt;?php while(has_sub_field('homepage_carousel')): ?&gt;
                  &lt;div class="item active"&gt;
                      &lt;img src="&lt;?php the_sub_field('slide_image'); ?&gt;" alt="..."&gt;
                      &lt;a href="&lt;?php the_sub_field('slide_link'); ?&gt;"&gt;Explore&lt;/a&gt;
                  &lt;/div&gt;
              &lt;?php endwhile; ?&gt;
            &lt;/div&gt;
  </code></pre>