X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/a6f44f0edcda2471c5a33e4156c1c9488c7f3210..refs/tags/wordpress-3.7:/wp-includes/js/media-editor.js diff --git a/wp-includes/js/media-editor.js b/wp-includes/js/media-editor.js index fc497cd8..5e2a5fa6 100644 --- a/wp-includes/js/media-editor.js +++ b/wp-includes/js/media-editor.js @@ -236,6 +236,9 @@ args.perPage = -1; // Mark the `orderby` override attribute. + if( undefined !== attrs.orderby ) + attrs._orderByField = attrs.orderby; + if ( 'rand' === attrs.orderby ) attrs._orderbyRandom = true; @@ -283,9 +286,15 @@ attrs.id = props.uploadedTo; // Check if the gallery is randomly ordered. + delete attrs.orderby; + if ( attrs._orderbyRandom ) attrs.orderby = 'rand'; + else if ( attrs._orderByField && attrs._orderByField != 'rand' ) + attrs.orderby = attrs._orderByField; + delete attrs._orderbyRandom; + delete attrs._orderByField; // If the `ids` attribute is set and `orderby` attribute // is the default value, clear it for cleaner output.