In the gallery shortcode, handle mapping of "ids" to include and orderby before the post_gallery filter. see #21816. fixes #22617.
git-svn-id: http://core.svn.wordpress.org/trunk@22891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2b4da9e635
commit
09d59a0255
|
@ -669,6 +669,12 @@ function gallery_shortcode($attr) {
|
||||||
static $instance = 0;
|
static $instance = 0;
|
||||||
$instance++;
|
$instance++;
|
||||||
|
|
||||||
|
if ( ! empty( $attr['ids'] ) ) {
|
||||||
|
// 'ids' is explicitly ordered
|
||||||
|
$attr['orderby'] = 'post__in';
|
||||||
|
$attr['include'] = $attr['ids'];
|
||||||
|
}
|
||||||
|
|
||||||
// Allow plugins/themes to override the default gallery template.
|
// Allow plugins/themes to override the default gallery template.
|
||||||
$output = apply_filters('post_gallery', '', $attr);
|
$output = apply_filters('post_gallery', '', $attr);
|
||||||
if ( $output != '' )
|
if ( $output != '' )
|
||||||
|
@ -690,7 +696,6 @@ function gallery_shortcode($attr) {
|
||||||
'captiontag' => 'dd',
|
'captiontag' => 'dd',
|
||||||
'columns' => 3,
|
'columns' => 3,
|
||||||
'size' => 'thumbnail',
|
'size' => 'thumbnail',
|
||||||
'ids' => '',
|
|
||||||
'include' => '',
|
'include' => '',
|
||||||
'exclude' => ''
|
'exclude' => ''
|
||||||
), $attr));
|
), $attr));
|
||||||
|
@ -699,12 +704,6 @@ function gallery_shortcode($attr) {
|
||||||
if ( 'RAND' == $order )
|
if ( 'RAND' == $order )
|
||||||
$orderby = 'none';
|
$orderby = 'none';
|
||||||
|
|
||||||
if ( !empty( $ids ) ) {
|
|
||||||
// 'ids' is explicitly ordered
|
|
||||||
$orderby = 'post__in';
|
|
||||||
$include = $ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !empty($include) ) {
|
if ( !empty($include) ) {
|
||||||
$_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
|
$_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue