Prevent the removal of a manual 'orderby' attribute in the gallery shortcode.

props nofearinc.
fixes #24868.

Built from https://develop.svn.wordpress.org/trunk@25720


git-svn-id: http://core.svn.wordpress.org/trunk@25633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-10-07 19:02:10 +00:00
parent a00df382a3
commit a30d69e534
2 changed files with 10 additions and 1 deletions

View File

@ -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.

File diff suppressed because one or more lines are too long