Make WordPress Core

Ticket #24868: 24868.diff

File 24868.diff, 1.0 KB (added by nofearinc, 10 years ago)
  • wp-includes/js/media-editor.js

     
    236236                                args.perPage = -1;
    237237
    238238                                // Mark the `orderby` override attribute.
     239                                if( undefined !== attrs.orderby )
     240                                        attrs.orderByField = attrs.orderby;
     241                               
    239242                                if ( 'rand' === attrs.orderby )
    240243                                        attrs._orderbyRandom = true;
    241244
     
    281284                                // Copy the `uploadedTo` post ID.
    282285                                if ( props.uploadedTo )
    283286                                        attrs.id = props.uploadedTo;
    284 
     287                               
    285288                                // Check if the gallery is randomly ordered.
     289                                delete attrs.orderby;
     290                               
    286291                                if ( attrs._orderbyRandom )
    287292                                        attrs.orderby = 'rand';
     293                                else if ( attrs.orderByField && attrs.orderByField != 'rand' )
     294                                        attrs.orderby = attrs.orderByField;
     295                               
    288296                                delete attrs._orderbyRandom;
     297                                delete attrs.orderByField;
    289298
    290299                                // If the `ids` attribute is set and `orderby` attribute
    291300                                // is the default value, clear it for cleaner output.