Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am looking to create an alternate RSS feed for a specific group of tags with custom image sizes to be used with MailChimp.

Is it possible to customize RSS feeds for specific tags? For example the tag "Apple" we would like the feed to have an image size of 100x100 in the RSS feed, whereas for the tag "Orange" we would like the images to be of size 500x500? We're using this for a MailChimp RSS newsletter and MailChimp can only pickup the first image within the feed so we need the sizing to be done on a per-tag basis and on the feed-level rather within the HTML/CSS.

share|improve this question

1 Answer 1

Filter 'the_content_feed' or 'the_excerpt_rss' and use a thumbnail image of your choice.

Sample code, not tested:

add_filter( 'the_content_feed', 'wpse_70249_custom_thumb' );
add_filter( 'the_excerpt_rss', 'wpse_70249_custom_thumb' );

function wpse_70249_custom_thumb( $content )
{
    global $post;

    $thumb_size = 'post-thumbnail';

    if ( in_category( 'orange', $post )
    {
        $thumb_size = array ( 500, 500 );
    }
    if ( in_category( 'apple', $post )
    {
        $thumb_size = array ( 100, 100 );
    }

    $thumb = get_the_post_thumbnail( null, $thumb_size );

    return $thumb . $content;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.