Last active
December 15, 2015 18:29
-
-
Save thoronas/5304261 to your computer and use it in GitHub Desktop.
Code for using Flexslider with Advanced Custom Fields
This file contains 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 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