Skip to content

Instantly share code, notes, and snippets.

@secretstache
Created February 26, 2015 22:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save secretstache/c7bd3ddd4e5f928ceb26 to your computer and use it in GitHub Desktop.
Save secretstache/c7bd3ddd4e5f928ceb26 to your computer and use it in GitHub Desktop.
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