我偶然看到这个帖子https://ethanmarcotte.com/wrote/replyin/ 作者表示,他在RSS提要的每篇文章末尾添加了通过电子邮件链接的回复,因此人们可以选择通过电子邮件回复
在他的feed(XML格式)中,它如下所示
<p><a href="mailto:listener+rss@ethanmarcotte.com?subject=Reply%20to:%20“Bookiversary.”">Reply via email</a></p>
我使用下划线,它有几个默认提要模板,随WP安装而来。我查了WP Codexhttps://codex.wordpress.org/Customizing_Feeds 并且没有找到任何关于如何修改模板以添加此功能的具体信息。Question: 这是通过修改RSS模板来实现的吗?如果是,是哪一个,如何选择?
Update: 基于@birgire建议使用the_content_feed 过滤器,以下代码在我的RSS提要的末尾添加电子邮件地址(根据XML视图)
// add custom content to all feeds
function add_content_to_all_feeds($content) {
$after = \'<p><a href="mailto:hello@mail.com">Reply via email</a></p>\';
if (is_feed()) {
return $content . $after;
} else {
return $content;
}
}
add_filter(\'the_content_feed\', \'add_content_to_all_feeds\');