Showing posts with label custom content. Show all posts
Showing posts with label custom content. Show all posts

Monday, 24 October 2011

How to add custom content to RSS Feed posts in wordpress?


In the previous posts I shared how to add custom content to wordpress posts. Now I will share you how to add custom content to RSS feeds.
RSS (Rich Site Summary) is a format for delivering regularly changing web content. Now a day the sites using RSS feeds are increasing rapidly. Any end user may subscribe to the site RSS feeds .The users who subscribed will get all the latest updates, the user will directly go to the RSS feed our website and see the posts. Like this we may increase the number of users but the subscribed user even won’t come back to our website.

To make our subscribers to visit our home page frequently here is the solution. Add the site home link to all your RSS feeds. To achieve this add the following code to your theme functions.php file.

function addToRSS($content) { return $content.'Remember to stop by at Indian Recipes '; }
add_filter('the_excerpt_rss', 'addToRSS');
add_filter('the_content_rss', 'addToRSS');

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='http://feeds2.feedburner.com/wordpressnotes>RSS feed</a> </p>";
                $content.= "</div>";
        }

        return $content;
}