Prevent the removal of a manual 'orderby' attribute in the gallery shortcode.
props nofearinc. fixes #24868. git-svn-id: https://develop.svn.wordpress.org/trunk@25720 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
04f053ce0c
commit
23013c544a
@ -236,6 +236,9 @@
|
|||||||
args.perPage = -1;
|
args.perPage = -1;
|
||||||
|
|
||||||
// Mark the `orderby` override attribute.
|
// Mark the `orderby` override attribute.
|
||||||
|
if( undefined !== attrs.orderby )
|
||||||
|
attrs._orderByField = attrs.orderby;
|
||||||
|
|
||||||
if ( 'rand' === attrs.orderby )
|
if ( 'rand' === attrs.orderby )
|
||||||
attrs._orderbyRandom = true;
|
attrs._orderbyRandom = true;
|
||||||
|
|
||||||
@ -283,9 +286,15 @@
|
|||||||
attrs.id = props.uploadedTo;
|
attrs.id = props.uploadedTo;
|
||||||
|
|
||||||
// Check if the gallery is randomly ordered.
|
// Check if the gallery is randomly ordered.
|
||||||
|
delete attrs.orderby;
|
||||||
|
|
||||||
if ( attrs._orderbyRandom )
|
if ( attrs._orderbyRandom )
|
||||||
attrs.orderby = 'rand';
|
attrs.orderby = 'rand';
|
||||||
|
else if ( attrs._orderByField && attrs._orderByField != 'rand' )
|
||||||
|
attrs.orderby = attrs._orderByField;
|
||||||
|
|
||||||
delete attrs._orderbyRandom;
|
delete attrs._orderbyRandom;
|
||||||
|
delete attrs._orderByField;
|
||||||
|
|
||||||
// If the `ids` attribute is set and `orderby` attribute
|
// If the `ids` attribute is set and `orderby` attribute
|
||||||
// is the default value, clear it for cleaner output.
|
// is the default value, clear it for cleaner output.
|
||||||
|
Loading…
Reference in New Issue
Block a user