I have triying to parse some specific elements from a xml feed in my Wordpress using SimplePie and "get_items_tags" to fix namespaces (I wanna print the content, no attributes). At the end nothing is displayed, just empty "p" tags. I have been searching, but no idea of what I can be doing wrong, any help,please? Please check the code:
<?php if(function_exists('fetch_feed')) {
include_once(ABSPATH . WPINC . '/feed.php' );
$feed = fetch_feed( 'http://servizos.meteogalicia.es/rss/predicion/rssLocalidades.action?idZona=32054&dia=0&request_locale=gl');
$maxitems = $feed->get_item_quantity(25);
$rss_items = $feed->get_items(0, $maxitems);}
if ($maxitems == 0)
echo "<p>Nadena</p>";
else foreach ( $rss_items as $item ) : ?>
<p><?php echo $item->get_item_tags("http://purl.org/dc/elements/1.1/","tMax"); ?></p>
<p><?php echo $item->get_item_tags("http://purl.org/dc/elements/1.1/","tMin"); ?></p>
<?php endforeach; ?>
I needed to get the content of tag "thumbnail" and this worked for me:
$thumbnail = $item->get_item_tags('', 'thumbnail');
echo $thumbnail[0]["data"];