Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dynamic Soliloquy Slideshow using ACF
<?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
You can’t perform that action at this time.