checking for published epicenter posts before trying to output them in the frontpage...
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 30 Oct 2018 14:28:40 +0000 (10:28 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 30 Oct 2018 14:28:40 +0000 (10:28 -0400)
sidebar.php

index 9dfda4a..880d2c4 100644 (file)
                                                 'suppress_filters' => true,
 
                                             ); 
-                                            $epicenter_blog = get_posts( $args )[0]; 
+              
+                                            $epicenter_blog = get_posts( $args )[0];
                                             $date = strtotime($epicenter_blog->post_date);
                                             ?>
-                                            <h3><a href="<?php echo get_permalink($epicenter_blog->ID); ?>"><?php echo $epicenter_blog->post_title; ?></a></h3>
-                                            <div id="epicenter-post-date"><?php echo date("F j, Y",$date); ?></div>
-                                            <p><?php echo content_excerpt($epicenter_blog->ID, 35);?>...</p>
+                                            <?php if($epicenter_blog) : ?>
+                                                <h3><a href="<?php echo get_permalink($epicenter_blog->ID); ?>"><?php echo $epicenter_blog->post_title; ?></a></h3>
+                                                <div id="epicenter-post-date"><?php echo date("F j, Y",$date); ?></div>
+                                                <p><?php echo content_excerpt($epicenter_blog->ID, 35);?>...</p>
+                                            <?php endif;?>
                                         </div>
                                     </div>
                                 </div>
-                                
-                            </div>
+                             </div>
\ No newline at end of file