{"id":298,"date":"2010-10-30T16:45:18","date_gmt":"2010-10-30T20:45:18","guid":{"rendered":"http:\/\/jaewon.hwang.info\/jaewon\/?p=298"},"modified":"2012-12-17T09:50:59","modified_gmt":"2012-12-17T14:50:59","slug":"how-to-make-your-wordpress-a-rss-reader","status":"publish","type":"post","link":"https:\/\/jaewon.hwang.info\/jaewon\/2010\/10\/how-to-make-your-wordpress-a-rss-reader\/","title":{"rendered":"How to make your WordPress a RSS reader"},"content":{"rendered":"<p><a href=\"http:\/\/wordpress.org\/\" target=\"_blank\">WordPress<\/a> is my blogging tool. What I admire WordPress for is its simplicity and extensibility. It contains a lot of useful functions, yet the code is simple and easy to read. It is also very customizable with a little modification of the existing code. The more I know about WordPress, the more I sympathize with their motto, &#8220;Code is Poetry&#8221;.<\/p>\n<p>As an example of how easy to extend the functionality of WordPress, I here show a way to make a WordPress page which regularly fetches the contents of the blogs you like. It just takes the following 3 steps.<\/p>\n<p><!--more-->1. Write a blank WordPress page with a name you like. (e.g., &#8220;RSS&#8221;)<\/p>\n<p>2. In your theme folder, find &#8220;single.php&#8221; and make a copy of it with the same name as the page you just made. (e.g., &#8220;rss.php&#8221;) If you don&#8217;t find, just make an empty text file.<\/p>\n<p>3. Open the copy (or the empty text file) with any text editor and add the highlighted code below. Since you probably want to keep this page&#8217;s look the same as your theme, you can copy just the part of the highlighted lines for your necessity.<\/p>\n<pre class=\"brush: php; auto-links: false; toolbar: false; highlight: [3,4,5,6,7,9,10,11,12,13,15,16,23,24,25,26,27,28,29,30,31,32,34,35,36,37,38,39]\">&lt;?php\r\n\r\n\/\/ List the RSS addresses of the blogs you want to subscribe\r\n$url = array(\r\n\t'http:\/\/www.xkcd.com\/rss.xml',\r\n\t'http:\/\/www.phdcomics.com\/gradfeed_justcomics.php'\r\n);\r\n\r\n\/\/ Limit the number of the articles per blog as 1\r\nfunction twentyten_feed_options( $feeds ) {\r\n\t$feeds-&gt;set_item_limit(1);\r\n}\r\nadd_action( 'wp_feed_options', 'twentyten_feed_options' );\r\n\r\n\/\/ Get the contents of the blogs\r\n$feeds = fetch_feed($url);\r\n\r\nget_header(); ?&gt;\r\n\r\n\t\t&lt;div id=\"container\"&gt;\r\n\t\t\t&lt;div id=\"content\" role=\"main\"&gt;\r\n\r\n&lt;?php\r\n\tforeach($feeds-&gt;get_items() as $item):\r\n\t\t$feed = $item-&gt;get_feed();\r\n?&gt;\r\n\t\t\t\t&lt;div &lt;?php post_class(); ?&gt;&gt;\r\n\t\t\t\t\t&lt;h1 class=\"entry-title\"&gt;&lt;a href=\"&lt;?php echo $item-&gt;get_permalink(); ?&gt;\" target=\"_blank\"&gt;&lt;?php echo html_entity_decode($item-&gt;get_title(), ENT_QUOTES, 'UTF-8');?&gt;&lt;\/a&gt;&lt;\/h1&gt;\r\n\t\t\t\t\t&lt;div class=\"entry-meta\"&gt;\r\n\t\t\t\t\t\t&lt;span class=\"entry-date\"&gt;&lt;?php echo $item-&gt;get_date('l, F j, Y'); ?&gt;&lt;\/span&gt;\r\n\t\t\t\t\t\t&lt;span class=\"author vcard\"&gt;&lt;a href=\"&lt;?php echo $feed-&gt;get_permalink(); ?&gt;\" target=\"_blank\"&gt;&lt;?php echo $feed-&gt;get_title(); ?&gt;&lt;\/a&gt;&lt;\/span&gt;\r\n\t\t\t\t\t&lt;\/div&gt;\r\n\r\n\t\t\t\t\t&lt;div class=\"entry-content\"&gt;\r\n\t\t\t\t\t\t&lt;?php echo $item-&gt;get_content(); ?&gt;\r\n\t\t\t\t\t\t&lt;div class=\"clear\"&gt;&lt;\/div&gt;\r\n\t\t\t\t\t&lt;\/div&gt;&lt;!-- .entry-content --&gt;\r\n\t\t\t\t&lt;\/div&gt;&lt;!-- #post-## --&gt;\r\n&lt;?php endforeach; ?&gt;\r\n\r\n\t\t\t&lt;\/div&gt;&lt;!-- #content --&gt;\r\n\t\t&lt;\/div&gt;&lt;!-- #container --&gt;\r\n\r\n&lt;?php get_sidebar(); ?&gt;\r\n&lt;?php get_footer(); ?&gt;\r\n<\/pre>\n<p>That&#8217;s it. Now you can see all your favorite blogs at one place of your blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress is my blogging tool. What I admire WordPress for is its simplicity and extensibility. It contains a lot of useful functions, yet the code is simple and easy to read. It is also very customizable with a little modification of the existing code. The more I know about WordPress, the more I sympathize with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[72],"class_list":["post-298","post","type-post","status-publish","format-standard","hentry","category-computer","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/posts\/298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/comments?post=298"}],"version-history":[{"count":0,"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/posts\/298\/revisions"}],"wp:attachment":[{"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/media?parent=298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/categories?post=298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaewon.hwang.info\/jaewon\/wp-json\/wp\/v2\/tags?post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}