Fix block to use proper Block attributes instead of post data
authorLaury GvR <laury@gaslightmedia.com>
Wed, 3 Jul 2019 21:11:42 +0000 (17:11 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 3 Jul 2019 21:11:42 +0000 (17:11 -0400)
parts/glm-blocks.php

index f1ebf59..8c32607 100644 (file)
@@ -9,12 +9,22 @@
                     <div class="row">
 
                         <div class="small-12 columns home-feed-post-content">
-                            <h2 style="font-size: 22px;" class="title-posts" href="<?php the_permalink(); ?>"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
+                            <h2 style="font-size: 22px;" class="title-posts" href="<?php the_permalink(); ?>">
+                                <?php if ($post->url) { ?>
+                                    <a class="post-link" href="<?php echo $post->url;?>"<?php if($post->externalUrl){echo ' target="_blank"';}?>>
+                                        <?php $block->post_title ?>
+                                    </a>
+                                <?php } else { ?>
+                                    <?php $block->post_title ?>
+                                <?php } ?>
+                            </h2>
                             <div class="post-excerpt excerpt<?php echo $count ?>"><?php echo the_advanced_excerpt('length=50&length_type=words&no_custom=1&ellipsis=%26hellip;&exclude_tags=img,p,strong,h1,h2,h3,hr,div'); ?>
                             </div>
-                            <div class="read-more">
-                                <a class="post-link" href="<?php echo $block->url;?>"<?php if($block->externalUrl){echo ' target="_blank"';}?>>Learn More</a>
-                            </div>
+                            <?php if ($post->url) { ?>
+                                <div class="read-more">
+                                    <a class="post-link" href="<?php echo $post->url;?>"<?php if($post->externalUrl){echo ' target="_blank"';}?>>Learn More</a>
+                                </div>
+                            <?php } ?>
                         </div>
                     </div>
                 </div>