moving conditional around block image to avoid having an anchor if no link
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 2 Aug 2017 16:21:52 +0000 (12:21 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 2 Aug 2017 16:21:52 +0000 (12:21 -0400)
adjusting the conditionals to remove the anchor if there is no link set in the block
admin

parts/glm-blocks.php

index 6b4e549..4b747c1 100644 (file)
@@ -35,16 +35,16 @@ default:
     <div class="text-center medium-text-left small-12 large-4 columns block interior-block-container">
         <div class="row medium-collapse block-container interior-block column">
             <div class="small-12 columns interior-block-image-container">
+               <?php  $image = get_the_post_thumbnail_url($block->ID, 'full'); ?>
                 <?php if($block->url):?>
-                  <?php  $image = get_the_post_thumbnail_url($block->ID, 'full'); ?>
                     <a href="<?php echo $block->url;?>"<?php if($block->externalUrl){echo ' target="_blank"';}?>>
-                        <?php endif;?>
+                 <?php endif;?>
                         <?php if($image){ ?>
                             <div class="interior-block-image" style="background-image: url(<?php echo $image; ?>)"></div>
                         <?php } else { ?>
                             <div class="block-no-image"></div>
                         <?php } ?>
-                        <?php if($block->url):?>
+                  <?php if($block->url):?>
                     </a>
                 <?php endif;?>
             </div>