get_posts fixes from DD32 and filosofo. see #6772

git-svn-id: https://develop.svn.wordpress.org/trunk@7892 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-05-05 15:46:32 +00:00
parent b0ff8876f0
commit 468ac2a54e
2 changed files with 7 additions and 4 deletions
+3 -1
View File
@@ -408,10 +408,12 @@ function get_posts($args = null) {
'order' => 'DESC', 'include' => '',
'exclude' => '', 'meta_key' => '',
'meta_value' =>'', 'post_type' => 'post',
'post_status' => 'publish', 'post_parent' => 0
'post_parent' => 0
);
$r = wp_parse_args( $args, $defaults );
if ( empty( $r['post_status'] ) )
$r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
if ( ! empty($r['numberposts']) )
$r['posts_per_page'] = $r['numberposts'];
if ( ! empty($r['category']) )