Created
October 6, 2019 19:35
-
-
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
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
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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome! I will test this and report back! Oh and any comment on any platform is fine by me ;-)