
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>
<div class="aritcle_card">
<a class="aritcle_card_img" href="/xiazai/code/11225">
<img src="https://img.php.cn/upload/webcode/000/000/017/176541120974891.jpg" alt="I-Shop购物系统">
</a>
<div class="aritcle_card_info">
<a href="/xiazai/code/11225">I-Shop购物系统</a>
<p>部分功能简介:商品收藏夹功能热门商品最新商品分级价格功能自选风格打印结算页面内部短信箱商品评论增加上一商品,下一商品功能增强商家提示功能友情链接用户在线统计用户来访统计用户来访信息用户积分功能广告设置用户组分类邮件系统后台实现更新用户数据系统图片设置模板管理CSS风格管理申诉内容过滤功能用户注册过滤特征字符IP库管理及来访限制及管理压缩,恢复,备份数据库功能上传文件管理商品类别管理商品添加/修改/</p>
<div class="">
<img src="/static/images/card_xiazai.png" alt="I-Shop购物系统">
<span>0</span>
</div>
</div>
<a href="/xiazai/code/11225" class="aritcle_card_btn">
<span>查看详情</span>
<img src="/static/images/cardxiayige-3.png" alt="I-Shop购物系统">
</a>
</div>
";
$content.= "</div>";
}
return $content;
}
add_filter ('the_content', 'insertFootNote');以上例子的效果是在每篇文章的尾部自动添加订阅提示。
推荐教程:WordPress教程
以上就是wordpress怎么自动在正文内容后添加内容的详细内容,更多请关注php中文网其它相关文章!
全网最新最细最实用WPS零基础入门到精通全套教程!带你真正掌握WPS办公! 内含Excel基础操作、函数设计、数据透视表等
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号