Skip to content

Instantly share code, notes, and snippets.

@thoronas
Last active December 15, 2015 18:29
Show Gist options
  • Save thoronas/5304261 to your computer and use it in GitHub Desktop.
Save thoronas/5304261 to your computer and use it in GitHub Desktop.
Code for using Flexslider with Advanced Custom Fields
<?php if(get_field('slider')): ?>
<script>
jQuery(window).load(function($) {
$('.flexslider').flexslider({
animation: "slide"
});
});
</script>
<div class="flexslider">
<ul class="slides">
<?php while(has_sub_field('slider')): ?>
<li>
<?php $image = wp_get_attachment_image_src(get_sub_field('image'), 'wpf-home-featured'); ?>
<img src="<?php echo $image[0]; ?>">
</li>
<?php endwhile; ?>
</ul>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment