Import Feed With WordPress

This tutorial is for WordPress users. Sometimes, you want to import and attach an RSS Feed into somewhere in your page instead on sidebars. To do this, there are two possible method. Use simple PHP or JavaScript. In this post, i will talk about using the PHP one because it is simpler.
By default, you should [...]

This tutorial is for WordPress users. Sometimes, you want to import and attach an RSS Feed into somewhere in your page instead on sidebars. To do this, there are two possible method. Use simple PHP or JavaScript. In this post, i will talk about using the PHP one because it is simpler.

By default, you should use PHP commands fopen() or file_get_contents() to fetch the feed content and output the data, but in WordPress, there is already function about it, it called fetch_feed() . Thanks to WordPress again :-)

Short of words, let have your PHP file ready to be editted. You can manually edit it on offline or using Theme Editor in Admin Page. And below is the short PHP code you should basically know:

<?php
$rss_url = Array("http://mr.hokya.com/","site2");
$feed = fetch_feed($rss_url);
wp_widget_rss_output($feed,"show_date=0&show_author=0&show_summary&items=5");
?>

Some benefit using this WordPress Declared Function

  1. It will fetches and shows your desired RSS Feed into somewhere you place that PHP code.
  2. It can fetches multiple RSS Feed from multiple URL and sorts it by the date
  3. This method uses fetch_feed() to automatically finds Feed URL of a site and fetches it into Feed Class.
  4. It uses wp_widget_rss_output to output the RSS Feed items. Naturally, it is used in RSS Widget :-)
  5. You can determine whether show the date or not by changing the value of show_date into 1 for showing, or 0 for not showing.
  6. You can determine whether show the author or not by changing the value of show_author into 1 for showing, or 0 for not showing.
  7. You can determine whether show the summary or not by changing the value of show_summary into 1 for showing, or 0 for not showing. If you choose 0, you will only see the title of the item.
  8. You can specify the max items of RSS feed to show within one site by changing the value items.

Posted on , , ,

Bookmark and Share

2 Responses to “Import Feed With WordPress”

Leave a Reply


AJAX Random Post

  • Alexa Trick: Increase Alexa Rank by Adding Subdomains

    Hello, i found some tricky way or tips about how to increase AlexaRank of your main domain. As you can read on the title, this method need subdomains. Maybe it is a bug for Alexa but it works on both default Alexa widget and Alexa API. Honestly, i created subdomains for better categorize reason, bu
  • Make WordPress Faster

    WordPress has become the best web platform which being used by million blogs all over the world. WordPress become famous because of its simplicity, clean, elegance, and user-friendly interface. It also being used over professional webmasters and beginners rookies. But not all of the wordpress fac
  • AJAX Comment Page

    If you are running big sites or popular blogs, you must have a lot of comments in your page. It does not matter where are the relevant and the spam, but a page with more than 100 comments in one page must be disturbing your new visitor to read them. As a result, some of your comments will not be rea
  • 10 Tips Submit DMOZ

    DMOZ is the oldest and largest Open Directory Project (ODP) to store huge information, pages, and caches more than billions of the entire world wide web. You must ever heard this kind of definition. DMOZ is the most popular database store, not only for the webmasters, but also for search engines. J
  • FaceBook Challenge Google

    FaceBook has grown up rapidly. In my environment, people always used to open Google at the first time they connect to Internet. But now, that behaviour has been changed. Now, they always open FaceBook as a welcome to the internet. I think it doesn not only happen in my area. Some of your friends (e

References

Who am I ?

My name is Julian Widya Perdana. I study at University of Gadjah Mada, Yogyakarta. I am a young developer addicted in JavaScript, Plugins, Themes, AJAX, and PHP developement. If you feel satisfy with my work, please support me to keep it developed