Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 134450

phamthang on "how can I get url from image tag in feed with fetch_feed?"

$
0
0

I used this piece of code in functions.php to add featured image in tag in feed

add_action('rss2_item', 'add_my_rss_node');

function add_my_rss_node() {
    global $post;
    if(has_post_thumbnail($post->ID)):
        $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'medium');
         $url = $thumbnail[0];
        echo("<image>{$url}</image>");
    endif;
}

then the url of featured image displayed in feed as I expected.

Now I want to pull this url out, I tried $item->get_title()
but it didn't show anything.

Now I wonder how can I get this url out?

this' my feed: http://techdaily.vn/feed and I follow this guide to use feed_fetch http://codex.wordpress.org/Function_Reference/fetch_feed

Thanks


Viewing all articles
Browse latest Browse all 134450

Trending Articles