If you have created a website powered by WordPress, the chances are that you’re are going to publish new content on a daily basis or at least weekly. If so, you will want to hand out your content to users. While many users will get updates from your site through the site itself and the social media pages you create, you shouldn’t forget about RSS feeds.
Rich Site Summary or Really Simple Syndication is designed to show frequent content and deliver it to a broad audience. RSS document which is known as a ‘feed’ consists of a title followed by a small excerpt, an image or different extra information about the posts, website, author, etc.
WordPress automatically creates a feed for your website, and you can easily see it on www.yourdomain.com/feed.
While you can easily show your own RSS feed simply by redirecting users to a link on your WordPress website, showing an external link could be a little bit more complicated. But don’t let that discourage you because you can still have any RSS feed displayed anywhere on your site just by copy/pasting a function which we’re going to show you in this article.
Instead of installing another plugin which will take control over the feeds and will require constant care and updates, you can create your own list. All you will have to do is change a link to the feed you want to display and modify the number of feeds shown on your site.
Whether you are going to show external RSS feed on a new page/post or you want to nest it in your sidebar, header or footer the procedure is practically the same:
- Open sidebar.php file or any file where you want the feed to show up
- Copy and paste the following code:
- Change the URL on the line #2
- Change number of RSS feeds which will be displayed on line #3
- Save changes
<?php include_once(ABSPATH.WPINC.'/feed.php'); $rss = fetch_feed('http:// http://dev.firstsiteguide.com/feed/'); $maxitems = $rss->get_item_quantity(4); $rss_items = $rss->get_items(0, $maxitems); ?> <ul> <?php if ($maxitems == 0) echo '<li>No items.</li>'; else // Loop through each feed item and display each item as a hyperlink. foreach ( $rss_items as $item ) : ?> <li> <a href='<?php echo $item->get_permalink(); ?>' title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'> <?php echo $item->get_title(); ?></a> </li> <?php endforeach; ?> </ul>
Now that you have set up one or several RSS feeds from other sites, don’t forget to take care of your own RSS feeds. We have shown you how to enable images in your feed and add custom text directly to your feeds. Sometimes, you will want to schedule your post for feeds and control how the feeds are generated with a simple function.
Instead of creating a list of feeds on the frontend where any visitor can access them, you can add any RSS feed list directly to your admin area so that only admins and authors can see the list.
How do you like RSS feed so far?