Feeds: Ensure that galleries can be output as a list of links in feeds.

Adjusts the gallery shortcode handler to check for the `link` attribute when outputting to a feed.

Fixes #22101.

Props ifrins, mdgl, SergeyBiryukov, chriscct7, stevenkword, iworks, DrewAPicture, birgire, whyisjake.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
whyisjake 2020-07-16 21:31:03 +00:00
parent a53b741359
commit 69aaab5108
2 changed files with 11 additions and 2 deletions

View File

@ -2250,7 +2250,16 @@ function gallery_shortcode( $attr ) {
if ( is_feed() ) { if ( is_feed() ) {
$output = "\n"; $output = "\n";
foreach ( $attachments as $att_id => $attachment ) { foreach ( $attachments as $att_id => $attachment ) {
$output .= wp_get_attachment_link( $att_id, $atts['size'], true ) . "\n"; if ( ! empty( $atts['link'] ) ) {
if ( 'none' === $atts['link'] ) {
$output .= wp_get_attachment_image( $att_id, $atts['size'], false, $attr );
} else {
$output .= wp_get_attachment_link( $att_id, $atts['size'], false );
}
} else {
$output .= wp_get_attachment_link( $att_id, $atts['size'], true );
}
$output .= "\n";
} }
return $output; return $output;
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-beta2-48495'; $wp_version = '5.5-beta2-48496';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.