<?php
$image['placeholder'] = get_the_post_thumbnail_url(get_the_ID(), 'placeholder');
$image['default'] = get_the_post_thumbnail_url(get_the_ID(), 'medium');
$image['retina'] = get_the_post_thumbnail_url(get_the_ID(), 'large');
$city = get_field('citta');
$address = get_field('indirizzo');
$link = get_field('gmap_link');
// if($link) {
  // $link = $link;
  // $target = '_blank';
// } else {
  $link = get_permalink();
  $target = '_self';
// }
?>

<div class="popup-marker">
  <div class="content">
    <header>
      <img class="icon" src="<?php echo get_template_directory_uri(); ?>/dist/images/icon-popup-marker.svg">
      <?php if($link):?>
        <a href="<?php echo $link; ?>" target="<?php echo $target; ?>">
      <?php endif;?>
        <?php if($city) echo '<h5>'.$city.'</h5>';?>
        <?php if($address) echo '<h3>'.$address.'</h3>';?>
      <?php if($link):?>
        </a>
      <?php endif;?>
    </header>
    <?php if($link):?>
      <a href="<?php echo $link; ?>" target="<?php echo $target; ?>" class="custom-underline lined-up"><?php _e("Visualizza", "blanka"); ?></a><span> ></span>
    <?php endif;?>
  </div>
</div>
