• Resolved dskbrk

    (@dskbrk)


    Hello,

    I just noticed that WordPress renders the [gallery] shortcode in a different way for the RSS2 feed.

    Instead of <dl> & <dt> tags there’s a plain link for every image, and it always point to the attachment page (instead of image url), like this:

    <a href='<em>attachment page link</em>' title='X'><img width="210" height="160" src="http://..image.jpg" class="attachment-thumbnail" alt="x" title="x" /></a>

    There is a way to render the gallery shortcode in the same way as of the standard HTML output?

    I also wonder if there are other difference between HTML and RSS outputs. I can’t find anything about this.

Viewing 1 replies (of 1 total)
  • Thread Starter dskbrk

    (@dskbrk)

    in wp-includes/media.php, function gallery_shortcode(), line 811, there’s:

    if ( is_feed() ) {
    		$output = "\n";
    		foreach ( $attachments as $att_id => $attachment )
    			$output .= wp_get_attachment_link($att_id, $size, true) . "\n";
    		return $output;
    	}

    I solved copying the whole function without those lines in my theme functions.php with a different name, then adding:

    add_shortcode('gallery', 'gallery_shortcode_fix');

Viewing 1 replies (of 1 total)

The topic ‘Gallery Shortcode renders different code in RSS2 feed’ is closed to new replies.