X

Promote your RSS feed on every post

Adding this snippet to the functions.php of your wordpress theme will add a link to your rss feed at the bottom of every post. If you are looking to get some new subscribers this is a great way to promote your feed.



Code Snippet:


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');

Comments  Leave a Reply

  1. Just wasted three hours figuring out what happened to my blog. Stops excerpts from showing and messes around with other stuff listed in functions.php too.

  2. This code changed my front page from displaying excerpts to displayng full posts.

    1. I use this code to display excerpts on my front page:


      $excerpt = get_the_excerpt();
      echo string_limit_words( $excerpt, 38 );

      function string_limit_words($string, $word_limit) {
      $words = explode(' ', $string, ($word_limit + 1));
      if(count($words) > $word_limit)
      array_pop($words);
      return implode(' ', $words);
      }

  3. and code needs to be internationalised to be able to use it for the other 52% of the internet…

  4. Just need to match your function name with your 2nd parameter $function_to_add and it works.

    1. Hi Brad, thanks for the heads up all fixed. Can’t imagine how I missed that,

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!