How to Insert content after each post in WordPress

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:

  1. How to Create Post Accordions in WordPress
  2. Free WordPress Theme – Inzpirashun
  3. WordPress Plugin – RSS Post Editor
  4. Free WordPress Theme – WpTechTuts v1.0
  5. How to make your WordPress Theme Widget Ready


The author is a small business owner himself specialising in Web Development. He runs Insight Studios which offers specialized Web Development, SEO Services and PPC Management for Small Business and SME thus ensuring growth and prosperity using the power of social media.

Share This Post

Related Articles

Leave a Reply

© 2012 MyGeekPal. All rights reserved. Site Admin · Entries RSS · Comments RSS
Designed by Insight Studios