Home > Article > CMS Tutorial > How to automatically add content after the main text content in WordPress
How does wordpress automatically add content after the text content
Many times, you need to add content after the article content Some information, such as subscriptions, article sharing, collections and Creative Commons license statements, etc.
If you want to automatically add content at the end of the article, you only need to add the code in the theme's 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');
The effect of the above example is that in each article A subscription reminder is automatically added at the end.
Recommended tutorial: WordPress tutorial
The above is the detailed content of How to automatically add content after the main text content in WordPress. For more information, please follow other related articles on the PHP Chinese website!