Created
February 26, 2015 22:11
-
-
Save secretstache/c7bd3ddd4e5f928ceb26 to your computer and use it in GitHub Desktop.
Dynamic Soliloquy Slideshow using ACF
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 | |
add_action( 'genesis_after_header', 'ssm_insert_slideshow', 99 ); | |
/** | |
* Builds the HTML for the homepage slideshow | |
* | |
*/ | |
function ssm_insert_slideshow() { ?> | |
<?php if ( $slides = get_field( 'slides' ) ) { ?> | |
<?php $image_ids = array(); ?> | |
<?php foreach ( $slides as $slide ) { | |
$image = $slide['image']; | |
$image_ids[] = $image['id']; | |
} ?> | |
<?php $image_id_list = implode(', ', $image_ids); ?> | |
<div class="slideshow"> | |
<?php soliloquy_dynamic( array( 'id' => 'homepage-slideshow', 'images' => $image_id_list ) ); ?> | |
</div> | |
<?php } ?> | |
<?php } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment