Created
May 9, 2013 23:45
-
-
Save FernE97/5551466 to your computer and use it in GitHub Desktop.
PHP: WordPress - Advanced Custom Fields Slider
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( 'slides' ) ) : // repeater field ?> | |
<ul class="slider"> | |
<?php while ( the_repeater_field( 'slides' ) ) : | |
$image = get_sub_field( 'slide' ); // sub-field image ID | |
$slide = wp_get_attachment_image_src( $image, 'slides' ); | |
$alt = get_post_meta( $image, '_wp_attachment_image_alt', true ); | |
?> | |
<li><img src="<?php echo $slide[0]; ?>" alt="<?php echo $alt; ?>"></li> | |
<?php endwhile; ?> | |
</ul> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment