0

SimplePie を使用して、Wordpress で RSS フィードを表示しています。何らかの理由で get_date 関数が何も返さないのですか? 以下は私のコードです。私のフィードに問題があるのでしょうか?

<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>
4

1 に答える 1

0

http://simplepie.org/wiki/setup/sample_pageで簡単なチェックを行ったところ、次のように機能しました。

<?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>

于 2012-07-04T13:17:25.213 に答える