Home / functions.php / Promote your RSS feed on every post
  • How to Promote your RSS feed on every post

    remove-wordpress-version-from-rss-feed

    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.

    ( click code to copy )

    wordpress snippet : PHP

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

    ( WordPress codex functions, hooks, in this snippet. )

    the_content, bloginfo, is_single, add_filter, wp,
  • Just need to match your function name with your 2nd parameter $function_to_add and it works.

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

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

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

    • 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);
      }

  • Tony Abbott

    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.