How To Improve Your WordPress RSS Feed

Improve Your WordPress RSS Feed

An RSS feed creates machine-readable data and displays it to the end-user in a convenient format. RSS or Rich Site Summary or Really Simple Syndication serves the purpose of delivering frequently changing content to a diverse audience. These options allow the users visiting your site to view your content whenever they wish to. Let us take a look at how you can Improve WordPress RSS Feed.

Changing the Feed

WordPress displays the RSS field on your dashboard by default. This feed has some content that does not appeal to everyone. So you can remove that part of the feed, and add content that is relevant. Follow the below steps to change WordPress feed:

1. Go to functions.php file
2. Copy and paste the below code:

function wpc_dashboard_widgets() {
global $wp_meta_boxes;
// remove unnecessary widgets
// var_dump( $wp_meta_boxes[‘dashboard’] ); // use to get all the widget IDs
unset(
$wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_plugins’],
$wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_secondary’],
$wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_primary’]
);
// add a custom dashboard widget
wp_add_dashboard_widget( ‘dashboard_custom_feed’, ‘WP Loop’, ‘dashboard_custom_feed_output’ ); //add new RSS feed output
}
function dashboard_custom_feed_output() {
echo ‘<div class=”rss-widget”>’;
wp_widget_rss_output(array(
‘url’ => ‘http://www.firstsiteguide.com/feed’,
‘items’ => 5,
‘show_summary’ => 1,
‘show_author’ => 0,
‘show_date’ => 1
));
echo “</div>”;
}
add_action(‘wp_dashboard_setup’, ‘wpc_dashboard_widgets’);

1. Makes changes to the parameter
2. Save the changes

You can change the url in the above function

‘url’ => ‘http://www.yourrssfeed.com/feed’

Summary, author, and date can only have Boolean values, which means you can choose whether to display them or not. To change the title of the field, modify the line:

wp_add_dashboard_widget( ‘dashboard_custom_feed’, ‘Example Title’, ‘dashboard_custom_feed_output’ );

By choosing what to display, you can Improve WordPress RSS Feed.

Add a Follow Button

add follow button
Instead of using a feed link, you can use a follow button. Using this button, the user can subscribe to your feed in Feedly, a web-based feed reader. To do this, you need to visit the Feedly Button factory website. Choose your button design and then add the RSS feed URL in the URL section.

Next, you need to copy and embed the HTML code snippet. You can paste this in the global area or the widget area. Be sure to save your work. You need to be a Feedly user to test this out. You can check in Feedly if your feed has been recognized, after clicking the ‘Follow’ button. By adding a follow button, you can Improve WordPress RSS Feed.

Enable Images

Adding images to your RSS feeds is beneficial because users are most likely to visit a site which has an image attached to its feed. To add an image to your feed, follow the below steps:

1. Open the functions.php file
2. Copy and paste the following code in the file:

add_filter(‘the_content_feed’, ‘rss_post_thumbnail’);
function rss_post_thumbnail($content) {
global $post;
if( has_post_thumbnail($post->ID) )
$content = ‘<p>’ . get_the_post_thumbnail($post->ID, ‘thumbnail’) . ‘</p>’ . $content;
return $content;
}

3. Save your changes

Each post has a featured image, and this same image will be used in the feed. This will Improve WordPress RSS Feed.

Schedule Your Posts For RSS

Sometimes you want to schedule your post to be published after some time, instead of publishing it immediately. You might want to modify the content a little bit before publishing it. Scheduling allows you to do exactly that. Here is how you can schedule posts:

1. Open the fucntions.php file
2. Copy and paste the following code in the file:

function scheduled_feed($where) {
global $wpdb;
function scheduled_feed($where) {
global $wpdb;
if ( is_feed() ) {
// timestamp in WP-format
$now = gmdate(‘Y-m-d H:i:s’);
// value for wait; + device
$wait = ’10’; // integer
// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
$device = ‘MINUTE’; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
// add SQL-sytax to default $where
$where .= ” AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, ‘$now’) > $wait “;
}
return $where;
}
add_filter(‘posts_where’, ‘scheduled_feed’);

1. Change the values of $device and $wait to adjust the delay time.
2. Save your changes.

By scheduling your posts and publishing them after a delay time of your choosing, you can Improve WordPress RSS Feed.

Redirecting feeds to Feedburner

By redirecting your feeds to Feedburner, you can use their statistical and tracking services. In order to do this, backup your .htaccess file, then add the below code to it and then save:

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

Insert Ads

Follow these steps to insert an AD:

1. Open functions.php and paste the following code:

<?php
function insertAds($content) {
$content = $content.'<hr /><a href=”http://www.wprecipes.com”>Have you visited WpRecipes today?</a><hr />’;
return $content;
}
add_filter(‘the_excerpt_rss’, ‘insertAds’);
add_filter(‘the_content_rss’, ‘insertAds’);
?>

2. Save changes.

Feed for Each Post

You can use a feed for comments in a particular post so that users can follow them easily. For this, you need to call the post_comments_feed_link() function.

Display Feeds by Category

To do this, edit any one of your theme files and paste the following code:

<?php wp_list_categories(‘feed_image=http://www.myblog.com/image.gif&feed=XML Feed&optioncount=1&children=0’); ?>

Save your changes.

Summarizing the Article in the Feed

It is not advisable to display your entire post in the RSS feed. They can read the entire content in the feed itself and there is no need for them to visit your site to read the post. But, if you summarize your posts in your feed, users will visit your site to view the whole articles. If you have advertisements on your site that you want people to see, then summarizing is useful. To achieve this:

  • Navigate to the settings area of your WordPress site.
  • Click on ‘Reading’.
  • Find the label, ‘For each article in a feed, show’, and select the radio button labeled ‘Summary’.
  • Save your changes

Now, users will only be able to view a summary of your content and will need to visit your website to access the full content. This can Improve WordPress RSS Feed.

Category-Specific RSS fields

Offering a feed for every category can Improve WordPress RSS Feed. To achieve this, just add ‘feed’ at the end of the URL for the category.

RSS fields can certainly improve your website traffic and thus by optimizing it, you will get more visitors engaged to your website.