I am using the following to display google maps using hotel_address custom field.
<iframe width="440" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=<?php the_field('hotel_address'); ?>&iwloc=&output=embed"></iframe><br /><small>
And it is working fine, getting hotel address and displaying a map, however I would like to hide this is hotel_address is blank.
I have tried the following
<?php
$map = get_post_meta($post->ID, 'hotel_address', true);
if ( $map ) {
echo '<iframe width="440" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q="'.$map.'"&iwloc=&output=embed"></iframe><br /><small>';
echo '';
}
?>
And can confirm that $map is picking up the address by using echo $map however it just shows a blank box without any map.
Any ideas? Richard
if($map !="")
work? and does the 1st code block show a map and the second fail to do so?