WordPress 的 RSS 可以让您的网站内容得到更好的展示,但是却有一个缺点,作为一个站长,可能有些东西无法显示在网站里面,但是 RSS 可以弥补这样的一个缺陷。这里我们使用了两个WordPress 的 hooks 来向 WordPress 的 RSS 添加内容。
// Additional RSS Content
$rss_more_content = 'blah blah blah';
$rss_more_position = 'before'; // or "after"
// Function which adds content to RSS entries
function add_rss_content($content) {
global $rss_more_position;
if(is_feed()) {
if ($rss_more_position == 'before') {
$content = $rss_more_content . "\n" . $content;
} else {
$content .= $rss_more_content . "\n";
}
}
return $content;
}
// Add hooks
add_filter('the_content', 'add_rss_content');
add_filter('the_excerpt_rss', 'add_rss_content');
唯一的条件是你是否想要的内容的内容块的顶部或底部添加。 这个函数应该进入你的 functions.php 文件,但是你怎么拉在额外的内容在是你的。