Home › Forums › Add-ons › Gallery Field › Add external URL link for gallery images › Reply To: Add external URL link for gallery images
I see the output when I do a print_r, but I’m not having much luck when I echo my carousel_url. Thoughts?
<?php $carousel_images = get_field( 'carousel' ); ?>
<?php if ( $carousel_images ) : ?>
<?php foreach ( $carousel_images as $carousel_image ): ?>
<div class="carousel-item" style="background-image: url('<?php echo $carousel_image['sizes']['large']; ?>');">
<?php
$images = get_field('carousel');
for ($i=0; $i<count($images); $i++) {
$images[$i]['carousel_url'] = get_field('carousel_url', $images[$i]['id']);
}
echo '<pre>'; print_r($images); echo '</pre>';
echo $image['carousel_url'];
?>
</div>
<?php endforeach; ?>
<?php endif; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.