WordPress hacks: Promote your RSS feed

By adding the following code to your functions.php you can add a link to the bottom of every post asking people to sign up to your RSS feed (of course, edit the text and you can get it to say what you want). What a great way to promote your RSS feed and gain some new subscribers…

function wps_promote_feed($content,$class = “promote”) {
echo $content
;
if (is_single()) {
?>
<div class=“<?php echo $class; ?>”>
<h3>Enjoyed this article?</h3>
<p>Please consider subscribing to our <a class=“feed” href=“<?php bloginfo(‘rss2_url’); ?>” title=“Subscribe via RSS”>RSS feed!</a></p>
</div>
<?php
}
}
add_filter
(‘the_content’,‘wps_promote_feed’);

Let me know how it goes and if you have any feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *