Ticket #42548: 42548.2.diff
File 42548.2.diff, 2.2 KB (added by , 7 years ago) |
---|
-
src/wp-includes/media.php
1666 1666 $atts = shortcode_atts( array( 1667 1667 'order' => 'ASC', 1668 1668 'orderby' => 'menu_order ID', 1669 'id' => $post ? $post->ID : 0,1669 'id' => null, 1670 1670 'itemtag' => $html5 ? 'figure' : 'dl', 1671 1671 'icontag' => $html5 ? 'div' : 'dt', 1672 1672 'captiontag' => $html5 ? 'figcaption' : 'dd', … … 1676 1676 'exclude' => '', 1677 1677 'link' => '' 1678 1678 ), $attr, 'gallery' ); 1679 1680 if ( null !== $atts['id'] ) { 1681 $id = intval( $atts['id'] ); 1682 } else { 1683 $id = $post ? intval( $post->ID ) : null; 1684 } 1679 1685 1680 $id = intval( $atts['id'] );1681 1682 1686 if ( ! empty( $atts['include'] ) ) { 1683 1687 $_attachments = get_posts( array( 'include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); 1684 1688 … … 1686 1690 foreach ( $_attachments as $key => $val ) { 1687 1691 $attachments[$val->ID] = $_attachments[$key]; 1688 1692 } 1689 } elseif ( ! empty( $atts['exclude'] ) ) { 1690 $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); 1691 } else { 1692 $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); 1693 } elseif ( $id !== null ) { 1694 if ( ! empty( $atts['exclude'] ) ) { 1695 $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); 1696 } else { 1697 $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) ); 1698 } 1693 1699 } 1694 1700 1695 1701 if ( empty( $attachments ) ) {