Quantcast
Channel: How to display custom wordpress feed on an other wordpress site? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How to display custom wordpress feed on an other wordpress site?

$
0
0

I'm setting up two wordpress sites. I have a custom RSS Feed on my first site, and i want to display the custom field on my second site. It's the featured image.

I am able to display the standard fields "title" or "permalink" like this : "get_title(); ?>". But can not display the new field "image".

The custom RSS is :

<channel><title>TITRE CATEGORIE</title><atom:link href="http://127.0.0.1/site/feed/" rel="self" type="application/rss+xml" /><link>http://127.0.0.1/site</link><description>DESCRIPTION</description><lastBuildDate>Fri, 05 Jul 2019 13:15:21 +0000</lastBuildDate><language>fr-FR</language><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>1</sy:updateFrequency><generator>https://wordpress.org/?v=5.2.2</generator><item><title>TITRE</title><link>http://127.0.0.1/site/page</link><pubDate>Wed, 26 Jun 2019 15:56:57 +0000</pubDate><dc:creator><![CDATA[gregory]]></dc:creator><category><![CDATA[cat-1]]></category><category><![CDATA[cat-2]]></category><guid isPermaLink="false">http://127.0.0.1/site/?p=56</guid><description><![CDATA[<p>L’article <a rel="nofollow" href="http://127.0.0.1/site/page/">Webserie 1</a> est apparu en premier sur <a rel="nofollow" href="http://127.0.0.1/site">NOM DU SITE</a>.</p>]]></description><content:encoded><![CDATA[<p>L’article <a rel="nofollow" href="http://127.0.0.1/site/page/">TITRE</a> est apparu en premier sur <a rel="nofollow" href="http://127.0.0.1/site">NOM DU SITE</a>.</p>]]></content:encoded><image><![CDATA[http://127.0.0.1/site/wp-content/uploads/2019/07/cookies.jpg]]></image></item>

I use this code to display the rss :

<?php if(function_exists('fetch_feed')) {    include_once(ABSPATH . WPINC . '/feed.php');    $feed = fetch_feed('http://127.0.0.1/site/tag/musique/feed/');    $limit = $feed->get_item_quantity(1);    $items = $feed->get_items(0, $limit);} ?><?php foreach ($items as $item) : ?><?php echo $item->get_title(); ?><?php echo $item->get_permalink(); ?><?php echo $item->image; ?><?php endforeach; ?>

The field "image" display nothing... How to target this line of the items ?Thanks for your help \o/


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images