0
votes

I want to retrieve RSS feed post from http://www.espncricinfo.com/rss/content/story/feeds/4.xml. And I have used RSS Autopilot Plugin for Wordpress. But, Problem is that the Images they set is using Differ method and javascript. So, this plugin not able to fetch images for some Post. Any way to fetch images for all post . ?

4

4 Answers

1
votes

Another solution (solution no:2):--

open your theme’s functions.php file and add the following code:

function rss_post_thumbnail($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '<p>' . get_the_post_thumbnail($post->ID) .
'</p>' . get_the_content();
}
return $content;
}
add_filter('the_excerpt_rss', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');
1
votes

very simple using Featured Image In RSS Feed plugin (solution no:1):--

1.https://wordpress.org/plugins/featured-image-in-rss-feed/

1
votes

Another solution (solution no:3):--

step 1:--

Install the free “Featured Images in RSS (https://wordpress.org/plugins/featured-images-for-rss-feeds/)” plugin.

step:2:--

Then in your WordPress dashboard click into “Settings” and then into “Featured Images in RSS Feeds.”

Step 3:--

You can then choose the size of your featured image and the positioning/alignment. The default sizes available will be thumbnail, medium, and large which are setup in your WordPress media settings.

1
votes

Another solution no:4(try this one)--

step:-- 1

Firstly create template(which page show all feed post)

i have create template example like:--

<?php
/*
Template Name:feed_post
Description:all show feed post
*/
get_header();
?>
   <style>
img.attachment-100x100.size-100x100.wp-post-image {
    display: none;
}    
img.attachment-thumbnail.size-thumbnail.wp-post-image {
    display: none;
}
</style>
<?php
$rss=fetch_feed('http://www.espncricinfo.com/rss/content/story/feeds/4.xml');  
//define which post show 
$rss_items = $rss->get_items(0, 10);

foreach($rss_items as $item) 
{
?>
    <a href="<?php echo $item->get_permalink(); ?>" title="<?php echo $item->get_date('j F Y @ g:i a'); ?>"><?php echo $item->get_title(); ?></a> 

<?php
echo '<div>'.$item->get_description().'</div>';

}
?>
    <?php
get_footer(); 
?>

step:-- 2

Using any plugin add Featured Images your feed:--

plugin name:-- 1.Send Images to RSS (https://wordpress.org/plugins/send-images-rss/)

2. Featured Image In Rss Feed (https://wordpress.org/plugins/featured-image-in-rss-feed/)