You might a seen many blogs display some automatic content after each post. This may be a call for subscription to their feeds, or a banner advertisement or some recent or related posts. Let alone recent or related posts, we shall see how to add static content after their posts. Using this tutorial you wont be needing to mess up with your themes each time you need to add some same HTML at the end of your posts.
We will be using functions.php for this. Just open up the functions.php add this
function contentfooter($content) {
if(!is_feed() && !is_home()) {
$content.= "<div class='postfooter subscribe'>";
$content.= "<h4>Enjoyed this article?</h4>";
$content.= "<p>Subscribe to our <a href='http://feeds2.feedburner.com/mygeekpal'>RSS feed</a> and never miss a recipe!</p>";
$content.= "</div>";
}
return $content;
}
add_filter ('the_content', 'contentfooter');
The next time you switch your theme, you wont be needing to mess up much with the theme to add some content on all the pages.
Related posts:
