HomeHow To

Useful RSS Tricks for WordPress

Useful RSS Tricks for WordPress
Like Tweet Pin it Share Share Email

Download Divi,The Ultimate WordPress Theme & Visual Page Builder

Divi WordPress Theme

RSS (Rich Site Summary) uses a family of standard web feed formats to publish frequently updated information: blog entries, news headlines, audio, video. … RSS feeds enable publishers to syndicate data automatically. Many news sites, blogs and other online publishers syndicate their content as an RSS Feed to whoever wants it.By default, WordPress automatically generates the RSS feed for your website.

Some useful Tricks That can be done on your RSS Feed.

How to insert ads into your RSS feed

1.open your function.php file and add the code below.

function wp_insertRss($content) {
$content = 'text before content'.$content.'text after content';
return $content;
add_filter('the_excerpt_rss', 'wp_insertRss');
add_filter('the_content', 'wp_insertRss');

2. Simply change the text before content and text after content to anything you want.

To add a hyperlink to your RSS Feed ,change the third line with the code below

$content = 'text before content'.$content.'<hr /><a href="http://www.yengkokpam.com">Have you visited WpBold.com today?</a><hr />';

Redirect WordPress Feeds to FeedBurner feeds

Sometime you dont want to display the default wordpress feed as its quite simple and can’t do much with it. So to redirect the default wordpress feed , which is always yoursite.com/feed by default to Feedburner, simple add the below code in your .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteRule ^feed/?([_0-9a-z-] )?/?$ http://feeds2.feedburner.com/wpbeginner [R=302,NC,L]

Add a Different Text or Ad To Each Post in WordPress RSS Feed
The code below will add a text/ad code to each post in the RSS feed of your WordPress website using custom field.
1.Add this code to the functions.php file of your theme.
2.Add a custom field with name customRSScontent for each post on your site and then put the custom text or ad code in its value field. This code or text will then automatically display at the end of each post in your RSS feed.

function wp_insertCustomRss($content) {
global $wp_query;
$postid = $wp_query->post->ID;
$customRSScontent = get_post_meta($postid, 'customRSScontent', true);
if(is_feed()) {
if($customRSScontent !== '') {
$content = $content."<br /><br /><div>".$customRSScontent."</div>
else {
$content = $content;
return $content;
add_filter('the_excerpt_rss', 'wp_insertCustomRss');
add_filter('the_content', 'wp_insertCustomRss');

Click the image below to Download Divi,The Ultimate WordPress Theme & Visual Page Builder

Divi WordPress Theme

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *