WordPress.org

Make WordPress Core

Changeset 7892


Ignore:
Timestamp:
05/05/08 15:46:32 (7 years ago)
Author:
ryan
Message:

get_posts fixes from DD32 and filosofo. see #6772

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r7838 r7892  
    350350 
    351351    extract(shortcode_atts(array( 
    352         'orderby'    => 'menu_order ASC, ID ASC', 
     352        'order'      => 'ASC', 
     353        'orderby'    => 'menu_order ID', 
    353354        'id'         => $post->ID, 
    354355        'itemtag'    => 'dl', 
     
    360361 
    361362    $id = intval($id); 
    362     $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby={$orderby}"); 
     363    $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) ); 
    363364 
    364365    if ( empty($attachments) ) 
     
    434435    global $post; 
    435436    $post = get_post($post); 
    436     $attachments = array_values(get_children("post_parent=$post->post_parent&post_type=attachment&post_mime_type=image&orderby=menu_order ASC, ID ASC")); 
     437    $attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') )); 
    437438 
    438439    foreach ( $attachments as $k => $attachment ) 
  • trunk/wp-includes/post.php

    r7880 r7892  
    409409        'exclude' => '', 'meta_key' => '', 
    410410        'meta_value' =>'', 'post_type' => 'post', 
    411         'post_status' => 'publish', 'post_parent' => 0 
     411        'post_parent' => 0 
    412412    ); 
    413413 
    414414    $r = wp_parse_args( $args, $defaults ); 
     415    if ( empty( $r['post_status'] ) ) 
     416        $r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish'; 
    415417    if ( ! empty($r['numberposts']) ) 
    416418        $r['posts_per_page'] = $r['numberposts']; 
Note: See TracChangeset for help on using the changeset viewer.