Skip to content

Instantly share code, notes, and snippets.

@luisfelipe-dev
Created November 25, 2016 17:46
Show Gist options
  • Select an option

  • Save luisfelipe-dev/3d637c53e042a0c2ab1eb014719dd713 to your computer and use it in GitHub Desktop.

Select an option

Save luisfelipe-dev/3d637c53e042a0c2ab1eb014719dd713 to your computer and use it in GitHub Desktop.
Loop para adicionar uma classe ao primeiro elemento.
<?php $firstMarked = false; ?>
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<dt class="collapsible-title <?php echo !$firstMarked ? "is-active":"";?>">
<h1><?php the_field('titulo1_video'); ?></h1>
<h2><?php the_field('titulo2_video'); ?></h2>
</dt>
<dd class="collapsible-content">
<?php if(have_rows('videos_youtube')): while(have_rows('videos_youtube')) : the_row(); ?>
<div class="video-yt">
<div class="embed-responsive embed-responsive-16by9">
<iframe width="560" height="315" src="https://www.youtube.com/embed/<?php the_sub_field('link_video');?>" frameborder="0" allowfullscreen></iframe>
</div>
</div><!-- /video -->
<?php endwhile; else : endif; ?>
</dd><!-- /collapsible-title is-active -->
<?php $firstMarked = true;?>
<?php endwhile; else: endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment