wordpress怎么自动在正文内容后添加内容

很多时候,你都需要在文章内容后面添加一些信息,例如订阅,文章分享,收藏和Creative Commons协议声明等。

要在文章尾部自动添加内容的话,只需要在主题的function.php里添加一下代码:

function insertFootNote($content) {

if(!is_feed() && !is_home()) {

$content.= “<div class=’subscribe’>”;

$content.= “<h4>Enjoyed this article?</h4>”;

$content.= “<p>Subscribe to our <a href=’http://feed.php.cn/’>RSS feed</a> and never miss a recipe!</p>”;

$content.= “</div>”;

}

return $content;

}

add_filter (‘the_content’, ‘insertFootNote’);

以上例子的效果是在每篇文章的尾部自动添加订阅提示。更多请关注网站的其它相关文章!

wordpress怎么自动在正文内容后添加内容 (https://www.wp-admin.cn/) WordPress使用教程 第1张

相关推荐

发表回复

房先生
我们将24小时内回复。
2024-07-17 18:50:43
您好,有任何疑问请与我们联系!
您的工单我们已经收到,我们将会尽快跟您联系!
[QQ客服]
2781198
加我微信
[电话联系]
13585372227
[电子邮件]
chaoneo@163.com
取消

选择聊天工具: