I want to import news to my WordPress site from an RSS structure like this:
<item>
<title>...title...</title>
<link>..link...</link>
<description>...short description...</description>
<full-text>...full-text...</full-text>
<enclosure url="http://.../post_image123.jpg" type="image/jpeg"/>
<category>...category...</category>
<pubDate>Wed, 20 Nov 2013 17:32:41 +0400</pubDate>
</item>
I know how to get all of the tags except full-text
, and I’ve not found any documentation about this. How do I get full-text
?
Code:
<?php
$rsslist = array(
'http://kavkazinfo.net/backend.php?region=%C4%E0%E3%E5%F1%F2%E0%ED',
'http://kavkazinfo.net/backend.php?region=%C8%E7%F0%E0%E8%EB%FC',
);
// Fetch all of the feeds into a simplePie mashup
$rss = fetch_feed($rsslist);
// Set the max items to either 5 or all items if there are less than 10
$maxitems = $rss->get_item_quantity(5);
// Get the items (0-5)
$rss_items = $rss->get_items(0, $maxitems);
// If there are no items, output that
if ($maxitems == 0) {
echo '<li>No items.</li>';
// Otherwise loop over the items
} else {
foreach ($rss_items as $item) { ?>
<li>
<?php echo $item->get_fulltext(); ?> // Of course, get_fulltext() doesn't exist as a function, so how do I get it?
</li>
<?php
}
}
?>
Try get_item_tags():
AFAIK
full-text
is a nonstandard feed element so SimplePie’s methods don’t handle it.Some simple searching lead me to this:
http://simplepie.org/wiki/reference/start#simplepie_item
You might try get_Content();