Home › Forums › Add-ons › Gallery Field › Add external URL link for gallery images › Reply To: Add external URL link for gallery images
You need to use the ID of the image when getting the url field. You can either loop through them and get the images first or you can loop through them and get the link where you need it. This example is for getting them all first.
<?php
$images = get_field('cruise_lines', 'travel-category_74');
for ($i=0; $i<count($images); $i++) {
// the id of the image is in $images[$i]['ID']
$images[$i]['link_url'] = get_field('link_url', $images[$i]['ID']);
}
?>
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.