Last active
December 13, 2016 21:45
-
-
Save brycejacobson/4d9660be4f2b218da07f27449d29b116 to your computer and use it in GitHub Desktop.
WordPress Foundation 6 Video Grid with Advance Custom Fields Repeater
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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