我正在尝试使用fetchfeed()
在我的博客中包含RSS提要,并在侧边栏中循环浏览项目.php。我得到的不是提要,而是此文本"找不到文件简单派.php"。我搜索了一段时间,只能找到类简单派.php的参考资料,而不是简单派.php。有谁知道这里发生了什么?
这是我的代码:
<?php if(function_exists('fetch_feed')): ?>
<?php include_once(ABSPATH.WPINC.'/feed.php');
$feed = fetch_feed('feed URL');
$limit = $feed->get_item_quantity(5);
$items = $feed->get_items(0, $limit);
if(!$items) {
echo "There was an error.";
} else { ?>
<?php foreach($items as $item): ?>
<div class="sidebar_post">
<p class="date"><?php echo $item->get_date('F j, Y'); ?></p>
<h5><?php echo $item->get_title(); ?></h5>
<p><?php echo $item->get_content(); ?></p>
</div>
<?php endforeach; ?>
<? } ?>
<?php endif; ?>
将此行添加到您的 wp-config 中.php
定义('WP_MEMORY_LIMIT', '64M');