Only show published post
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 22 Jun 2016 14:47:32 +0000 (10:47 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 22 Jun 2016 14:47:32 +0000 (10:47 -0400)
So it doesn't show the draft post items.

parts/blog-sidebar-r.php

index 240de61..2c82045 100644 (file)
@@ -8,7 +8,7 @@
                 <p>Recent Posts</p>
                 <ul>
                 <?php
-                        $args = array( 'numberposts' => '5' );
+                        $args = array( 'numberposts' => '5','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> ';
@@ -30,4 +30,4 @@
                     ?>
                 </ul>
             </div>
-        </div>
\ No newline at end of file
+        </div>