【发布时间】:2014-02-26 17:37:50
【问题描述】:
我目前正在使用类似的方法从我的另一个博客的 RSS 提要中提取一篇文章。两个站点都是同一服务器上的 Wordpress(不是 MU) 问题是我希望能够提取摘录、发布日期、类别和论文发布图片或缩略图。现在我只能得到帖子标题和永久链接才能工作。任何对 get_content 或 get_excerpt 等的尝试都失败了。非常感谢任何帮助。
<?php include_once(ABSPATH . WPINC . '/feed.php');
$rss = fetch_feed('http://idea-driven.com/feed/');
if(!empty($rss)):
$maxitems = $rss->get_item_quantity(1);
$rss_items = $rss->get_items(0, $maxitems);
endif;
?>
<ul>
<?php foreach ( $rss_items as $item ) : ?>
<li>
<a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
【问题讨论】: