Hi All!
We want to replace a slider with a clickable random image. So far I have half of this working using this code that pulls one image from the ACF gallery and displays it:
<?php
$images = get_field('gallery', '', false); // Adding the
false` parameter returns raw/unformatted value
$size = 'full'; // (thumbnail, medium, large, full or custom size)
$rand = array_rand($images ?? [null]);
$attr = ["alt"=>"random image"];
if( $images ): ?>
<?php echo wp_get_attachment_image( $images[$rand], $size, "", $attr ); ?>
<?php endif; ?>
What I can't seem to find is how to then use the image's custom link, so that the image is also clickable (where the user loads the image and assigns the desired custom link).
Anyone have any idea how to get this to work?
Cheers!
G