Support

Account

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;
    ?>