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 have setuped showing rss from my network site using fetch_feed();

include_once(ABSPATH . WPINC . '/feed.php');
$rss = fetch_feed('rss link here');
$maxitems = $rss->get_item_quantity(5);
$rss_items = $rss->get_items(0, $maxitems);
THen i can use foreach to get these 
$item->get_description(); 
$item->get_permalink();
$item->get_title();
get_date('j F Y | g:i a'); 

But i am not sure how to get thumbnail in my feed or here in this system. But in my posts i do have a custom field called post-img for displaying posts.

Help is appreciated. Thanks

share|improve this question
    
Hi, could you please provide the full code block? –  Michael Ecklund May 29 '12 at 15:34
    
this is pretty much the complete code.. just need echos in the last 4 lines.. –  Ayaz Malik May 30 '12 at 10:32
1  
Can you post a link to the feed you're parsing? It's likely that your custom field (post-img) isn't in the feed to begin with, but without knowing what the field is we can't help you parse it. –  EAMann May 31 '12 at 15:13
    
sure its, apps.designzzz.com/feed and yes it doesn't contain a thumbnail. i tried some functions from google whihc will add thumbnail to feed but instead it started showing the entire post in feed. –  Ayaz Malik May 31 '12 at 15:17

1 Answer 1

up vote 4 down vote accepted
+50

According to the Codex, fetch_feed() uses the SimplePie engine for parsing RSS.

So, if $item->get_title(); is working, then you should be able to do:

$item->get_thumbnail();

as per the SimplePie documentation, as long as there are any thumbnails already on the feed.

UPDATE:

Before running the above, you have to insert the images on your feed. Check for display featured image in RSS feed and How to grab first image attached to post and display in RSS feed? topics on it.

share|improve this answer
    
i have already checked that but it dosen't work maybe because there is no thumbnail in the feed im fetching but yes i do have a custom field in that feed's posts which got link to thumbanil.. –  Ayaz Malik May 31 '12 at 15:18
    
updated answer with links to "how to place custom field images on RSS" –  moraleida May 31 '12 at 15:24
    
k i have used the second method it worked and added first image in the feed, but now on getting the feed it gives thsi error : Call to undefined method SimplePie_Item::get_thumbnail() –  Ayaz Malik May 31 '12 at 15:32
    
Did you try using the enclosure method described on the docs? -> simplepie.org/wiki/reference/simplepie_enclosure/get_thumbnail –  moraleida May 31 '12 at 15:39
    
Thanks Sorted it out :} –  Ayaz Malik Jun 1 '12 at 13:52

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.