I have a created a collection of fields in ACF for a single post.
Content Heading
Content
Slider - Gallery
Image
Gallery
Using the Query loop I want to have the field Slider queried in bricks slider.
But no matter what I do I only get one image.
How hard can it be to create a simple Image slider
?
Tried both nestable and basic slider, and ACSS slider.
Any hints ?
Hi
see the post from aslotta approx. in the middle of this discussion:
Cheers
Patric
2 Likes
Thanks Patric, I will take a look at it.
I think is a really simple feature missing…
I got to work like this with the new slider “splide”
custom code element with
<div class="splide">
<div class="splide__track">
<div class="splide__list">
<?php
$gallery = get_field("gallery");
if($gallery){
foreach($gallery as $image){
echo "<div class='splide__slide'>";
echo wp_get_attachment_image($image["ID"]);
echo "</div>";
}
}
?>
</div>
</div>
<script>
(()=>{
const el = document.currentScript.closest(".splide")
window.addEventListener("load", ()=>{
new Splide( el).mount();
})
})()
</script>
</div>
use $image["ID"]
or $image
depending on what you return on the field