Skip to content

Instantly share code, notes, and snippets.

@wordpressvn
Last active March 7, 2023 08:51
Show Gist options
  • Save wordpressvn/0e43024bd8fa226186a729cc354958ef to your computer and use it in GitHub Desktop.
Save wordpressvn/0e43024bd8fa226186a729cc354958ef to your computer and use it in GitHub Desktop.
ACF Gallery Flatsome
<?php
$property_gallery = get_field('property_gallery');
?>
<?php $i = 0; if( $property_gallery ) : $i++; ?>
<div class="woocommerce-product-gallery property-gallery-slider slider slider-nav-small mb-half flickity-enabled is-draggable"
data-flickity-options='{
"cellAlign": "center",
"wrapAround": true,
"autoPlay": true,
"prevNextButtons":true,
"adaptiveHeight": true,
"imagesLoaded": true,
"lazyLoad": 1,
"dragThreshold" : 15,
"pageDots": false,
"rightToLeft": false,
"fullscreen": true }'
>
<?php foreach ( $property_gallery as $image ) { ?>
<div class="slide <?php echo $i == 1 ? ' is-nav-selected' : ''; ?>"><a class="image-lightbox lightbox-gallery" href="<?php echo $image['url']; ?>"><img height="400px" src="<?php echo $image['sizes']['medium_large']; ?>" alt="<?php echo $image['alt']; ?>" title="<?php echo $image['alt']; ?>"></a></div>
<?php } ?>
</div>
<div class="product-thumbnails thumbnails slider row row-collapse row-slider slider-nav-small small-columns-6 flickity-enabled is-draggable"
data-flickity-options='{
"cellAlign": "center",
"wrapAround": false,
"autoPlay": false,
"prevNextButtons": true,
"asNavFor": ".property-gallery-slider",
"percentPosition": true,
"imagesLoaded": true,
"pageDots": false,
"rightToLeft": false,
"contain": true
}'
>
<?php foreach ( $property_gallery as $image ) { ?>
<div class="col <?php echo $i == 1 ? ' first' : ''; ?>">
<a><img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" class="attachment-woocommerce_thumbnail" /></a>
</div>
<?php } ?>
</div>
<?php else : ?>
<a class="image-lightbox lightbox-gallery" href="<?php the_post_thumbnail_url('full'); ?>">
<?php the_post_thumbnail('large'); ?>
</a>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment