Skip to content

Instantly share code, notes, and snippets.

@frankmeeuwsen
Created October 6, 2019 19:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankmeeuwsen/a9409c0fced66c8bb560bca9ac82f538 to your computer and use it in GitHub Desktop.
Save frankmeeuwsen/a9409c0fced66c8bb560bca9ac82f538 to your computer and use it in GitHub Desktop.
How to get a specific text at a specific category in your WordPress feed
function dtd_rssclub($content) {
global $wp_query;
$postid = $wp_query->post->ID;
if(is_feed() && has_category('RSS-Club', $postid) ) {
$content = '<div>Dit is een geheim bericht voor iedereen. <a href="/rss-club">Lees alles over de RSS Club</a></div><br /><br />'.$content;
}
else {
$content = $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'dtd_rssclub');
add_filter('the_content_rss', 'dtd_rssclub');
@frankmeeuwsen
Copy link
Author

Awesome! I will test this and report back! Oh and any comment on any platform is fine by me ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment