Home › Forums › Front-end Issues › Relationship field & google maps › Reply To: Relationship field & google maps
what I currently have, but doesn’t work is:
<div class="acf-map">
<?php
$featured_projects = get_field('locations_all');//relationship
if( $featured_projects ): ?>
<?php foreach( $featured_projects as $featured_project ):
$featured_project_id = $featured_project->ID;
$location = get_field('location');//field
?>
<div class="marker" data-lat="<?php echo $location['lat'], $featured_project_id; ?>" data-lng="<?php echo $location['lng'], $featured_project_id; ?>">
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
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.