{"id":353,"date":"2012-02-09T12:53:12","date_gmt":"2012-02-09T03:53:12","guid":{"rendered":"http:\/\/www.santoshkori.com\/blog\/?p=353"},"modified":"2012-08-23T17:29:22","modified_gmt":"2012-08-23T08:29:22","slug":"how-to-display-your-latest-tweets-on-your-wordpress-blog-without-any-plugin","status":"publish","type":"post","link":"https:\/\/www.santoshkori.com\/blog\/how-to-display-your-latest-tweets-on-your-wordpress-blog-without-any-plugin\/","title":{"rendered":"How to display your latest tweets on your WordPress blog without any plugin"},"content":{"rendered":"<p>Simply paste the following code anywhere in your theme files, where you want the tweets to be displayed.<\/p>\n<p><!--more--><br \/>\nDon&#8217;t forget to update the code with your username on line 3. Max items to display can be defined on line 4.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\ninclude_once(ABSPATH . WPINC . '\/feed.php');\r\n$rss = fetch_feed('https:\/\/api.twitter.com\/1\/statuses\/user_timeline.rss?screen_name=catswhocode');\r\n$maxitems = $rss-&gt;get_item_quantity(3);\r\n$rss_items = $rss-&gt;get_items(0, $maxitems);\r\n?&gt;\r\n\r\n&lt;ul&gt;\r\n&lt;?php if ($maxitems == 0) echo '&lt;li&gt;No items.&lt;\/li&gt;';\r\nelse\r\n\/\/ Loop through each feed item and display each item as a hyperlink.\r\nforeach ( $rss_items as $item ) : ?&gt;\r\n&lt;li&gt;\r\n&lt;a href='&lt;?php echo $item-&gt;get_permalink(); ?&gt;'&gt;\r\n&lt;?php echo $item-&gt;get_title(); ?&gt;\r\n&lt;\/a&gt;\r\n&lt;\/li&gt;\r\n&lt;?php endforeach; ?&gt;\r\n&lt;\/ul&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Simply paste the following code anywhere in your theme files, where you want the tweets to be displayed.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,14,5,184],"tags":[186,188,187,185,725],"class_list":["post-353","post","type-post","status-publish","format-standard","hentry","category-just-blogging","category-web-development","category-wordpress","category-wordpress-tip-and-tricks","tag-display-your-latest-tweets-on-your-wordpress","tag-display-your-latest-tweets-on-your-wordpress-blog-without-any-plugin","tag-how-to-display-your-latest-tweets-on-your-wordpress-blog-without-any-plugin","tag-latest-tweets-on-your-wordpress-blog","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/comments?post=353"}],"version-history":[{"count":7,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/353\/revisions"}],"predecessor-version":[{"id":693,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/posts\/353\/revisions\/693"}],"wp:attachment":[{"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/media?parent=353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/categories?post=353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.santoshkori.com\/blog\/wp-json\/wp\/v2\/tags?post=353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}