Created
May 20, 2012 17:57
-
-
Save mattrude/2758927 to your computer and use it in GitHub Desktop.
Adds a small footer to all rss & atom feed posts in WordPress.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************** | |
* Add Footer to WordPress RSS feeds. Add this snippet to your functions.php | |
*/ | |
function mdr_postrss($content) { | |
if(is_feed()){ | |
$site_name = get_bloginfo_rss('name'); | |
$post_title = get_the_title_rss(); | |
$home_url = home_url('/'); | |
$post_url = post_permalink(); | |
$content = $content.'<a href="'.$post_url.'">'.$post_title.'</a> is a post from: | |
<a href="'.$home_url.'">'.$site_name.'</a> which is not allowed to be copied on other sites.'; | |
} | |
return $content; | |
} | |
add_filter('the_excerpt_rss', 'mdr_postrss'); | |
add_filter('the_content', 'mdr_postrss'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment