Monday, 3 October 2011

How to add custom content to each post automatically?

Many bloggers will have a habit to write custom content after each post. Like “We welcome your suggestions on this blog “ Or something like ask readers to subscribe their RSS feed “If you like this post subscribe to our rss feed”.

We can hard code this content after the post content or we can add it every time when we write a new post. Adding this content every time, when we write a new article is not the right choice.

To automate this one add the following code to your theme functions.php i.e

function addFootNote($content) {
        if(is_feed() || is_single()) {
                $content.= "<div class='subscribes'>";
                $content.= "<h4>like this article?</h4>";
                $content.= "<p>Subscribe to our  <a href='>RSS feed</a> </p>";
                $content.= "</div>";

        return $content;


  1. Is this function to be hooked to 'the_content' hook? Or else where should i make a call to this function?

  2. ya hisham this function is hooked to the_content just copy this code in functions.php no need to call this again.keep watch my blog.thanks for the comment

  3. I mean shouldn't we do add_action('the_content','addFootNote'); in functions.php?