WordPress.org

Make WordPress Core

Ticket #21816: 21816.diff

File 21816.diff, 893 bytes (added by markjaquith, 6 years ago)
  • wp-includes/media.php

    function gallery_shortcode($attr) { 
    801801                'captiontag' => 'dd',
    802802                'columns'    => 3,
    803803                'size'       => 'thumbnail',
     804                'ids'        => '',
    804805                'include'    => '',
    805806                'exclude'    => ''
    806807        ), $attr));
    function gallery_shortcode($attr) { 
    809810        if ( 'RAND' == $order )
    810811                $orderby = 'none';
    811812
     813        if ( !empty( $ids ) ) {
     814                // 'ids' is explicitly ordered
     815                $orderby = 'post__in';
     816                $include = $ids;
     817        }
     818
    812819        if ( !empty($include) ) {
    813820                $include = preg_replace( '/[^0-9,]+/', '', $include );
    814821                $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );