Skip to content

Instantly share code, notes, and snippets.

@brycejacobson
Last active December 13, 2016 21:45
Show Gist options
  • Save brycejacobson/4d9660be4f2b218da07f27449d29b116 to your computer and use it in GitHub Desktop.
Save brycejacobson/4d9660be4f2b218da07f27449d29b116 to your computer and use it in GitHub Desktop.
WordPress Foundation 6 Video Grid with Advance Custom Fields Repeater
<?php
// check if the repeater field has rows of data
if (have_rows('video_grid')): ?>
<div class="row">
<div class="small-12 small-centered medium-10 columns">
<ul class="small-block-grid-1 medium-block-grid-2">
<?php
// loop through the rows of data
while (have_rows('video_grid')) : the_row();
// display a sub field value
echo '<li>';
the_sub_field('video');
echo '</li>';
endwhile;
?>
</ul>
</div>
</div>
<?php
else :
// no rows found
endif;
?>
// Wrap oembed videos with foundation flex-video class
jQuery('iframe[src*="youtube.com"], iframe[src*="vimeo.com"]').each(function() {
if ( jQuery(this).innerWidth() / jQuery(this).innerHeight() > 1.5 ) {
jQuery(this).wrap("<div class='widescreen flex-video vimeo'/>");
} else {
jQuery(this).wrap("<div class='flex-video vimeo'/>");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment