如何在不使用插件的情况下在WP RSS提要中包含相关帖子?我在google和stackexchange上搜索过,但没有结果。感谢所有朋友!
如何在WP RSS提要中包含相关帖子
1 个回复
最合适的回答,由SO网友:Krzysiek Dróżdż 整理而成
你必须使用the_content
和the_excerpt_rss
挂钩。您可以这样做:
function rss_append_footer($content) {
if(is_feed()) {
$related_posts_html = ... // I assume you already can compute it
$content .= $related_posts_html;
}
return $content;
}
add_filter(\'the_content\', \'rss_append_footer\');
add_filter(\'the_excerpt_rss\', \'rss_append_footer\');
结束