0

i have a theme (classipress) that uses a custom post type the classified page doesn't use the wordpress featured image function it uses its own image function I was able to include the custom post types in RSS but i could not include the image of the classified item in the RSS feed

Any help ?

1

Better late than never I guess.

You have several options, first and easiest, you can install a plugin that searches for images in posts and the attach them as featured if no featured is found. This plugin can help you, but there are plenty more.

If you prefer not to rely in plugins, you can add a snippet in your functions.php file that searches for the first image in the post attachments and then features it. You have a tutorial here on how to accomplish this.

Lastly, you need to include the featured image in your RSS feed:

// display featured post thumbnails in WordPress feeds
function wcs_post_thumbnails_in_feeds( $content ) {
global $post;
if( has_post_thumbnail( $post->ID ) ) {
    $content = '<p>' . get_the_post_thumbnail( $post->ID ) . '</p>' .     $content;
}
return $content;
}
add_filter( 'the_excerpt_rss', 'wcs_post_thumbnails_in_feeds' );
add_filter( 'the_content_feed', 'wcs_post_thumbnails_in_feeds' );

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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