Fix case with ort but no orte

This commit is contained in:
Markus Ankenbrand 2024-10-29 23:09:31 +01:00
parent d6abc8d5a5
commit 8cfcc32212

View file

@ -75,25 +75,11 @@
<?php endif; ?> <?php endif; ?>
<?php $location = get_field( 'ort' ); ?> <?php $location = get_field( 'ort' ); ?>
<?php $locations = get_field( 'orte' ); ?> <?php $locations = get_field( 'orte' ); ?>
<?php if ( $location && (!$locations || count($locations)==0 || is_nan($locations[0]['lat'])) ) : ?> <?php
<div class="post-meta"> if ( $location && !$locations ) :
<div class='map' style='height:300px; margin-bottom: 1.6842em' id='map-<?php echo $id ?>-single'></div> $locations = [$location];
<script type='text/javascript'> endif;
var single_map; ?>
var single_map_center = {lat: <?php echo $location['lat'] ?>, lng: <?php echo $location['lng'] ?> };
function initMap() {
map = new google.maps.Map(document.getElementById('map-<?php echo $id ?>-single'), {
center: single_map_center,
zoom: 15
});
var marker = new google.maps.Marker({
position: single_map_center,
map: single_map
});
}
</script>
</div>
<?php endif; ?>
<?php if ( $locations && count($locations)>0 && !is_nan($locations[0]['lat'])) : ?> <?php if ( $locations && count($locations)>0 && !is_nan($locations[0]['lat'])) : ?>
<div class="post-meta"> <div class="post-meta">
<div class='map' style='height:300px; margin-bottom: 1.6842em' id='map-<?php echo $id ?>-multiple'></div> <div class='map' style='height:300px; margin-bottom: 1.6842em' id='map-<?php echo $id ?>-multiple'></div>