Home › Forums › ACF PRO › Google Maps crashing when no location data passed › Reply To: Google Maps crashing when no location data passed
Hi,
I’m having the same issue, can you guide me where to include the above code in my file? Thanks in advance!
<?php
while ( have_posts() ) : the_post();
$location = get_field(‘map’);
$lat = $location[‘lat’]; <—-Illegal string offset ‘lat’
$lng = $location[‘lng’]; <—-Illegal string offset ‘lng’
$coords = $lat.”,”.$lng;
$post_counter++;
if (strlen($lat) > 1) {
echo ‘[“<a href=’;
echo the_permalink();
echo “/’><h2>”;
echo the_title();
echo “</h2><div class=’impact’><div class=’address’><address>”;
echo the_field( ‘address_1’);
echo ‘</br>’;
echo the_field( ‘city’);
echo ‘ ‘;
echo the_field( ‘state’);
echo ‘ ‘;
echo the_field( ‘zip’);
echo ‘</address></div>’;
echo ‘</div>”, ‘;
echo $coords;
echo ‘, “/wp-content/themes/ci_old/map/marker’;
echo $post_counter;
echo ‘.png”,’;
echo $post_counter ;
echo ‘],’;
}
endwhile;
?>
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.