<?php // DO NOT USE THIS LINE
/*
* Demos using 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', 'bb_promote_my_feed' );
function bb_promote_my_feed( $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;
}