-
-
Save lori/63a4cf9f7bdc70ccc653 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Generate slideshow from ACF gallery field. | |
* | |
* A Flexslider (Soliloquy) slider will be created from from images assigned | |
* via the ACF gallery field type. | |
* | |
* The following plugins are needed: | |
* - Soliloquy | |
* - Soliloquy Dyanmic Addon | |
* - Soliloquy Crop Addon (for thumbnails only) | |
* | |
* For information and arguments available for the Dynamic addon are at: | |
* http://soliloquywp.com/docs/dynamic-addon/ | |
* | |
* @since 1.0.0 | |
*/ | |
function ja_gallery() { | |
$images = get_post_meta( get_the_ID(), '_ja_property_images', true ); | |
if ( $images ) { | |
$ids = ''; | |
$x = 1; | |
foreach( $images as $id ) { | |
if ( $x == 1 ) { | |
$ids .= $id; | |
} else { | |
$ids .= ',' . $id; | |
} | |
$x++; | |
} | |
echo '<div class="property-slideshow">'; | |
soliloquy_dynamic( array( | |
'preloader' => 'true', | |
'animate' => 'false', | |
'id' => 'custom-random-images', | |
'images' => $ids, | |
'link' => 'file', | |
'size' => 'gallery', | |
'width' => '400', | |
'height' => '250', | |
'thumbnails' => 'true', | |
'thumbnails_crop' => 'true', | |
'thumbnails_width' => '100', | |
'thumbnails_height' => '75', | |
'thumbnails_min' => '4', | |
'thumbnails_distance' => '10' | |
) ); | |
echo '</div>'; | |
} | |
} | |
add_action( 'genesis_entry_content', 'ja_gallery' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment