wordpress怎么自動在正文內容后添加內容? ??
很多時候,你都需要在文章內容后面添加一些信息,例如訂閱,文章分享,收藏和Creative Commons協議聲明等。?
要在文章尾部自動添加內容的話,只需要在主題的function.php里添加一下代碼:?
function?insertFootNote($content)?{? ????if(!is_feed()?&&?!is_home())?{? ????????$content.=?"<div>";? ????????$content.=?"<h4>Enjoyed?this?article?</h4>";? ????????$content.=?"<p>Subscribe?to?our?<a>RSS?feed</a>?and?never?miss?a?recipe!</p>";? ????????$content.=?"</div>";? ????}? ????return?$content;? }? add_filter?('the_content',?'insertFootNote');
以上例子的效果是在每篇文章的尾部自動添加訂閱提示。
推薦教程:WordPress教程?
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END
喜歡就支持一下吧
相關推薦