Only display published recent blog posts
authorLaury GvR <laury@gaslightmedia.com>
Thu, 4 Feb 2016 15:14:55 +0000 (10:14 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 4 Feb 2016 15:14:55 +0000 (10:14 -0500)
functions.php
parts/blog-sidebar-r.php

index 6559ebf..7948744 100644 (file)
@@ -143,14 +143,4 @@ add_action('thematic_searchloop', 'mytheme_search_loop');
 add_image_size('glm_blocks', '257', '257', true);
 // needed to keep Woocommerce from constantly complaining.
 add_theme_support( 'woocommerce' );
-?>
-
-<?php
-    $number_recents_posts = 3;
-    $args=array('numberposts' => $number_recents_posts,'post_status'=>'publish');
-
-    $recent_posts = wp_get_recent_posts( $args );
-    foreach($recent_posts as $post){
-        echo '<li><a href="' . get_permalink($post["ID"]) . '" title="Look '.$post["post_title"].'" >' .   $post["post_title"].'</a> <hr class="skinnydivider" /></li> ';
-    } 
 ?>
\ No newline at end of file
index 1cb0327..ebf0ace 100644 (file)
@@ -8,7 +8,8 @@
                 <p>Recent Posts</p>
                 <ul>
                 <?php
-                        $args = array( 'numberposts' => '5' );
+                        $number_recents_posts = 5;
+                        $args=array('numberposts' => $number_recents_posts,'post_status'=>'publish');
                         $recent_posts = wp_get_recent_posts( $args );
                         foreach( $recent_posts as $recent ){
                                 echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .   $recent["post_title"].'</a> </li> ';