Skip to content

Instantly share code, notes, and snippets.

@mattrude
Created May 20, 2012 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattrude/2758927 to your computer and use it in GitHub Desktop.
Save mattrude/2758927 to your computer and use it in GitHub Desktop.
Adds a small footer to all rss & atom feed posts in WordPress.
/********************************************************************************
* 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