Connecting WordPress RSS Feeds to Social Networks

social media, tutorials, wordpress 7884 Comments

It is considered as tremendous advantages for any website that show activities of social media over it. It creates a bond between your users and readers and emphasize that you are an active participant in your niche, this thing makes you a leader.

The best thing about doing this is that it is very reliable fast and easy to display social activities in WordPress.

Connecting WordPress RSS feeds to Social Networks

In case you need to show your social media activity, you will have to parse RSS feed of your account. The functionalities like Feedcache and Simple Pie are built into WordPress and allows you to use simple feature names as Fetch_feed.

Tool: RSS and ATOM Feed Reader - Parse and Validate RSS Feeds

The following tutorial will teach you to find and parse your feeds in simple steps.

1. Finding Social Networks Feed

In the first step, you will need specific RSS feeds of all your social media networks. Like here we are taking you for the most popular social media networks i.e. Facebook, Twitter, and Reddit.

How to Get Facebook Feed

You can see below how to grab the RSS feeds from your Facebook profile or business pages. Before I proceed let me share some stats.

By now you have likely noticed that your Facebook posts don't reach your entire fan base.

Recent research indicates that any shared post only reaches 6% of your fans, and that number continues to decline!.

For example, Out of every 100 of your page fans, less than 6 of them (on average) will see a post from your page.

Want to expose more people to your Facebook page content?

We'll show you how in just 3 easy steps.

Step #1: Start with the Facebook RSS Feed Root URL Format

Step #2: Add your Facebook ID

Enter your personal Facebook profile URL at Your profile URL is what is visible to the public.

Find your Facebook ID

For example, pattronizer's is:

Step #3: Add the Facebook ID to the end of RSS Feed URL from Step 1

Pattronizer's Facebook ID is: 272319169592338.

When added to the root URL, it looks like this:

Facebook Profile ID

Step #4: (Optional) Share your Facebook Page Updates on Other Social Media Sites

Add the new Facebook RSS feed URL to Route the updates to Twitter, LinkedIn, Tumblr and more.

When you click the links in the content, readers will be redirected back to Facebook to consume the entire update.

You can create an RSS feed of any Facebook page. It makes it easy to see all the updates.

How to Get Twitter Feed

You can use the tool to easily retrieve the feed. - Find Twitter User RSS Feed

Enter you twitter profile name and hit "Fetch RSS", that's it. You will get the RSS feed for your twitter profile.

How to Get Reddit Feed

For users of Reddit, it provides a direct link to anyone's account RSS feed. Just put your username in the following URL:

For example, let's say 'pattronize' is my Reddit User ID and I have replaced in the above RSS link. Finally I get

2. Parse Your Feed and Start Displaying it on Your Website

To use fetch_feed function you have RSS Feed now, so here is the code which you can use.

This code is provided by

<h2><?php _e( 'Recent news from Some-Other Blog:', 'my-text-domain' ); ?></h2>

<?php // Get RSS Feed(s)
include_once( ABSPATH . WPINC . '/feed.php' );

// Get a SimplePie feed object from the specified feed source.
$rss = fetch_feed( '' );

$maxitems = 0;

if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly

    // Figure out how many total items there are, but limit it to 5. 
    $maxitems = $rss->get_item_quantity( 5 ); 

    // Build an array of all the items, starting with element 0 (first element).
    $rss_items = $rss->get_items( 0, $maxitems );


    <?php if ( $maxitems == 0 ) : ?>
        <li><?php _e( 'No items', 'my-text-domain' ); ?></li>
    <?php else : ?>
        <?php // Loop through each feed item and display each item as a hyperlink. ?>
        <?php foreach ( $rss_items as $item ) : ?>
                <a href="<?php echo esc_url( $item->get_permalink() ); ?>"
                    title="<?php printf( __( 'Posted %s', 'my-text-domain' ), $item->get_date('j F Y | g:i a') ); ?>">
                    <?php echo esc_html( $item->get_title() ); ?>
        <?php endforeach; ?>
    <?php endif; ?>

All this code is doing will generate a list of 5 links where each of the links leads to the recent activity.

You will need to copy and paste this code into the sidebar.php file and before pasting the link please make sure that the phrase is changed with your own RSS feed link.

Now the question is how to implement this code?

If You Want to Display the Feeds in Your Sidebar

  • Go to admin dashboard
  • Navigate to appearance and then to the editor
  • From the list of .php files find the sidebar.php there and paste your code into this file and update the file.

Now you will be able to see all of your recent social media activities in the sidebar of your website.

It can be concluded as a flexible and simple method to display your activities on the social media networks. You are also free to modify the code related to your likes and can use it with other .php files.

Some of the RSS may be called out of date but still it is a powerful method which allows you to keep your visitors and readers continuously updated with your activity.

elegant themes banner

Related Articles:

You may be interested in:

Shara J, mid-level WordPress website developer working for Pattronize InfoTech. I do research on WordPress and other open source technologies and share my knowledge in my free time. You can contact Shara on Twitter, LinkedIn and Facebook.

Would you like to contribute to this site? Get started ยป
Rate this article:
(5.0 rating from 5 votes)