/* * This demo uses the_content filter to add an RSS * link to the end of every post. * * @uses the_content * @uses is_single() * @uses get_bloginfo() DO NOT use bloginfo() because it "echos" content immediately. * * @link https://developer.wordpress.org/reference/hooks/the_content/ * @link https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content * @link https://developer.wordpress.org/reference/functions/is_single/ * @link https://codex.wordpress.org/Conditional_Tags * @link https://developer.wordpress.org/reference/functions/get_bloginfo/ * * I used a custom class of "promote_my_rss" for the div wrapper. * You can make this whatever you'd like based on your available * styles. */ add_filter( 'the_content', function ( $content ) { if ( is_single() ) { $content .= '<div class="promote_my_rss"> <h3>Enjoyed this article?</h3> <p> Don\'t miss a single post. Subscribe to our <a class="feed" href="' . get_bloginfo( 'rss2_url' ) . '" title="Subscribe via RSS">RSS feed!</a> </p> </div>'; } return $content; });
Promote your RSS feed on every post
This post brought to you by RocketGeek, ButlerBlog, and the following: