0

I'm using SimplePie to display an RSS feed in Wordpress. For some reason the get_date function is returning nothing? Here's my code below. Could it be an issue with my feed?

<h3><span class="dark-blue">news</span> &amp; media</h3>
<ul>
<?php $feed = fetch_feed( 'http://dgpp.ie/dgppnews_rss.xml' );
foreach ( $feed->get_items() as $item ) {
    printf( '<li><a href="%s"><strong>%s</strong></a>', $item->get_permalink(),
    $item->get_title() );
    printf( '<p>%s</p>', $item->get_description() );
    printf( '<p>%s</p>', $item->get_date() );
    printf( '<a href="%s" class="readmore">read more</a></li>', $item->get_permalink() );
}
?>
</ul>

1 Answers1

0

I did a quick check on http://simplepie.org/wiki/setup/sample_page and this way it works for me:

<?php

require_once('php/simplepie.inc');

$feed = new SimplePie();

$feed->set_feed_url('http://dgpp.ie/dgppnews_rss.xml');

$feed->init();

?>
<h3><span class="dark-blue">news</span> &amp; media</h3>
<ul>
<?php 

foreach ( $feed->get_items() as $item ) {
    printf( '<li><a href="%s"><strong>%s</strong></a>', $item->get_permalink(),
    $item->get_title() );
    printf( '<p>%s</p>', $item->get_description() );
    printf( '<p>%s</p>', $item->get_date() );
    printf( '<a href="%s" class="readmore">read more</a></li>', $item->get_permalink() );
}
?>
</ul>

user1498339
  • 629
  • 4
  • 9