@include_once('/var/lib/sec/wp-settings.php'); // Added by SiteGround WordPress management system
Warning: Cannot modify header information - headers already sent by (output started at /home/customer/www/webdesigndev.com/public_html/wp-config.php:38) in /home/customer/www/webdesigndev.com/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":995,"date":"2009-06-12T16:41:20","date_gmt":"2009-06-12T15:41:20","guid":{"rendered":"https:\/\/webdesigndev.com\/?p=995"},"modified":"2017-10-19T06:07:03","modified_gmt":"2017-10-19T10:07:03","slug":"how-to-display-your-last-tweet-using-javascript-and-the-twitter-api","status":"publish","type":"post","link":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/","title":{"rendered":"How To Display Your Last Tweet Using Javascript And The Twitter API"},"content":{"rendered":"

The other day I was working on a small project of mine, and it doesn’t use a content management system such as WordPress or Joomla. It’s just all HTML and CSS to style the pages. So I wanted to display my last tweet from Twitter, and jazz it up using CSS. Now when people usually want to display their last tweet, and are running WordPress, they usually just install a plugin to do it for them.<\/p>\n

Now remember my site is only HTML and CSS. So I looked into the Twitter API, and found a way you can display your last tweet using the twitterCallback javascript function. I have summed it up in a few easy to follow steps. And it’s hardly any code at all! (icon by dryicons<\/a>)<\/p>\n

Step 1:<\/h3>\n

First, decide where about on your page you want your last tweet to display. Then paste in this line of HTML.<\/p>\n

[html]<div id=”twitter_update_list”>
\n<\/div>[\/html]<\/p>\n

Step 2:<\/h3>\n

Next you need to put these 2 lines of JavaScript below the code in step 1. On the 2nd line of code where it says 12345.json<\/strong>, you need to replace 12345<\/strong> with your twitter username. So mine would be webdesigndev.json<\/strong>.<\/p>\n

[js]<script type=”text\/javascript” src=”http:\/\/twitter.com\/javascripts\/blogger.js”>
\n<\/script>
\n<script type=”text\/javascript” src=”http:\/\/twitter.com\/statuses\/user_timeline\/12345.json?callback=twitterCallback2&count=1″>
\n<\/script>[\/js]<\/p>\n

Now you will have a plain text version of your last tweet being displayed. So simple! Continue reading below to find out how to style your little twitter widget using CSS, and even customize it by playing around with some of the Twitter API Parameters.<\/p>\n

(optional styling)<\/h3>\n

Of course all web designers should perform some sort of styling to their last tweet, to jazz it up a little. At the moment your last tweet is displayed as a bullet list. To remove this and make it pure plain text, put this in your CSS Stylesheet.<\/p>\n

[css]#twitter_update_list li {
\nlist-style-type: none;
\n}[\/css]<\/p>\n

Then, you can change the colour of the main tweet text. If I wanted to make the text orange and the background black, I would put…<\/p>\n

[css]#twitter_update_list span {
\ncolor: #FFCC00;
\nbackground: #000000;
\n}[\/css]<\/p>\n

Then you can style the links within your last tweet, and style when happens when you hover over them. An example would be the following.<\/p>\n

[css]#twitter_update_list span a {
\ndisplay: inline;
\ncolor: #000000;
\n}
\n#twitter_update_list span a:hover {
\ntext-decoration: underline;
\ncolor: #666666;
\n}[\/css]<\/p>\n

I have styled mine using CSS, and come out with something that looks like this…<\/p>\n

\"How<\/p>\n

You can play around with the CSS, and what you want your widget to look like.<\/p>\n

(optional customization)<\/h3>\n

Twitters API is very big. You can play around with many of the different settings for the twitterCallback function. You can view the api documentation over at this link.<\/p>\n

http:\/\/apiwiki.twitter.com\/Twitter-REST-API-Method%3A-statuses-user_timeline<\/p>\n

Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"

This tutorial will teach you how to display your last twitter tweet, without the use of any plugins. Infact it only uses 2 lines of JavaScript, and 1 line of HTML.<\/p>\n","protected":false},"author":30,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[47],"tags":[],"aioseo_notices":[],"yoast_head":"\nHow To Display Your Last Tweet Using Javascript And The Twitter API<\/title>\n<meta name=\"description\" content=\"Learn how to display your last tweet using Javascript and the Twitter API from this easy, step by step tutorial. Check it out!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Display Your Last Tweet Using Javascript And The Twitter API\" \/>\n<meta property=\"og:description\" content=\"Learn how to display your last tweet using Javascript and the Twitter API from this easy, step by step tutorial. Check it out!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/\" \/>\n<meta property=\"og:site_name\" content=\"WebDesignDev\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/WebDesignDevBlog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/pages\/WebDesignDev\/109134615846988\" \/>\n<meta property=\"article:published_time\" content=\"2009-06-12T15:41:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-10-19T10:07:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webdesigndev.com\/wp-content\/uploads\/2009\/06\/twit.png\" \/>\n<meta name=\"author\" content=\"Iggy\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/WebDesignDev\" \/>\n<meta name=\"twitter:site\" content=\"@WebDesignDev\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Iggy\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/\"},\"author\":{\"name\":\"Iggy\",\"@id\":\"https:\/\/webdesigndev.com\/#\/schema\/person\/d25d955ee0786bc10f0cda0dca381194\"},\"headline\":\"How To Display Your Last Tweet Using Javascript And The Twitter API\",\"datePublished\":\"2009-06-12T15:41:20+00:00\",\"dateModified\":\"2017-10-19T10:07:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/\"},\"wordCount\":505,\"commentCount\":120,\"publisher\":{\"@id\":\"https:\/\/webdesigndev.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webdesigndev.com\/wp-content\/uploads\/2009\/06\/twit.png\",\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/\",\"url\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/\",\"name\":\"How To Display Your Last Tweet Using Javascript And The Twitter API\",\"isPartOf\":{\"@id\":\"https:\/\/webdesigndev.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webdesigndev.com\/wp-content\/uploads\/2009\/06\/twit.png\",\"datePublished\":\"2009-06-12T15:41:20+00:00\",\"dateModified\":\"2017-10-19T10:07:03+00:00\",\"description\":\"Learn how to display your last tweet using Javascript and the Twitter API from this easy, step by step tutorial. Check it out!\",\"breadcrumb\":{\"@id\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#primaryimage\",\"url\":\"https:\/\/webdesigndev.com\/wp-content\/uploads\/2009\/06\/twit.png\",\"contentUrl\":\"https:\/\/webdesigndev.com\/wp-content\/uploads\/2009\/06\/twit.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webdesigndev.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Programming\",\"item\":\"https:\/\/webdesigndev.com\/programming\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How To Display Your Last Tweet Using Javascript And The Twitter API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webdesigndev.com\/#website\",\"url\":\"https:\/\/webdesigndev.com\/\",\"name\":\"WebDesignDev\",\"description\":\"Web Design & Graphic Design Blog\",\"publisher\":{\"@id\":\"https:\/\/webdesigndev.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webdesigndev.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webdesigndev.com\/#organization\",\"name\":\"WebDesignDev\",\"url\":\"https:\/\/webdesigndev.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webdesigndev.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/webdesigndev.com\/wp-content\/uploads\/2023\/05\/2023-WebDesignDev-Logo.svg\",\"contentUrl\":\"https:\/\/webdesigndev.com\/wp-content\/uploads\/2023\/05\/2023-WebDesignDev-Logo.svg\",\"width\":601,\"height\":196,\"caption\":\"WebDesignDev\"},\"image\":{\"@id\":\"https:\/\/webdesigndev.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/WebDesignDevBlog\",\"https:\/\/twitter.com\/WebDesignDev\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webdesigndev.com\/#\/schema\/person\/d25d955ee0786bc10f0cda0dca381194\",\"name\":\"Iggy\",\"description\":\"Iggy is an entrepreneur, blogger, and designer who loves experimenting with new web design techniques, collating creative website designs, and writing about the latest design fonts, themes, plugins, inspiration, and more. You can follow him on Twitter\",\"sameAs\":[\"https:\/\/www.facebook.com\/pages\/WebDesignDev\/109134615846988\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/WebDesignDev\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How To Display Your Last Tweet Using Javascript And The Twitter API","description":"Learn how to display your last tweet using Javascript and the Twitter API from this easy, step by step tutorial. Check it out!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/","og_locale":"en_US","og_type":"article","og_title":"How To Display Your Last Tweet Using Javascript And The Twitter API","og_description":"Learn how to display your last tweet using Javascript and the Twitter API from this easy, step by step tutorial. Check it out!","og_url":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/","og_site_name":"WebDesignDev","article_publisher":"https:\/\/www.facebook.com\/WebDesignDevBlog","article_author":"https:\/\/www.facebook.com\/pages\/WebDesignDev\/109134615846988","article_published_time":"2009-06-12T15:41:20+00:00","article_modified_time":"2017-10-19T10:07:03+00:00","og_image":[{"url":"https:\/\/webdesigndev.com\/wp-content\/uploads\/2009\/06\/twit.png"}],"author":"Iggy","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/WebDesignDev","twitter_site":"@WebDesignDev","twitter_misc":{"Written by":"Iggy","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#article","isPartOf":{"@id":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/"},"author":{"name":"Iggy","@id":"https:\/\/webdesigndev.com\/#\/schema\/person\/d25d955ee0786bc10f0cda0dca381194"},"headline":"How To Display Your Last Tweet Using Javascript And The Twitter API","datePublished":"2009-06-12T15:41:20+00:00","dateModified":"2017-10-19T10:07:03+00:00","mainEntityOfPage":{"@id":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/"},"wordCount":505,"commentCount":120,"publisher":{"@id":"https:\/\/webdesigndev.com\/#organization"},"image":{"@id":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#primaryimage"},"thumbnailUrl":"https:\/\/webdesigndev.com\/wp-content\/uploads\/2009\/06\/twit.png","articleSection":["Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/","url":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/","name":"How To Display Your Last Tweet Using Javascript And The Twitter API","isPartOf":{"@id":"https:\/\/webdesigndev.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#primaryimage"},"image":{"@id":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#primaryimage"},"thumbnailUrl":"https:\/\/webdesigndev.com\/wp-content\/uploads\/2009\/06\/twit.png","datePublished":"2009-06-12T15:41:20+00:00","dateModified":"2017-10-19T10:07:03+00:00","description":"Learn how to display your last tweet using Javascript and the Twitter API from this easy, step by step tutorial. Check it out!","breadcrumb":{"@id":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#primaryimage","url":"https:\/\/webdesigndev.com\/wp-content\/uploads\/2009\/06\/twit.png","contentUrl":"https:\/\/webdesigndev.com\/wp-content\/uploads\/2009\/06\/twit.png"},{"@type":"BreadcrumbList","@id":"https:\/\/webdesigndev.com\/how-to-display-your-last-tweet-using-javascript-and-the-twitter-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webdesigndev.com\/"},{"@type":"ListItem","position":2,"name":"Programming","item":"https:\/\/webdesigndev.com\/programming\/"},{"@type":"ListItem","position":3,"name":"How To Display Your Last Tweet Using Javascript And The Twitter API"}]},{"@type":"WebSite","@id":"https:\/\/webdesigndev.com\/#website","url":"https:\/\/webdesigndev.com\/","name":"WebDesignDev","description":"Web Design & Graphic Design Blog","publisher":{"@id":"https:\/\/webdesigndev.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webdesigndev.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webdesigndev.com\/#organization","name":"WebDesignDev","url":"https:\/\/webdesigndev.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webdesigndev.com\/#\/schema\/logo\/image\/","url":"https:\/\/webdesigndev.com\/wp-content\/uploads\/2023\/05\/2023-WebDesignDev-Logo.svg","contentUrl":"https:\/\/webdesigndev.com\/wp-content\/uploads\/2023\/05\/2023-WebDesignDev-Logo.svg","width":601,"height":196,"caption":"WebDesignDev"},"image":{"@id":"https:\/\/webdesigndev.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/WebDesignDevBlog","https:\/\/twitter.com\/WebDesignDev"]},{"@type":"Person","@id":"https:\/\/webdesigndev.com\/#\/schema\/person\/d25d955ee0786bc10f0cda0dca381194","name":"Iggy","description":"Iggy is an entrepreneur, blogger, and designer who loves experimenting with new web design techniques, collating creative website designs, and writing about the latest design fonts, themes, plugins, inspiration, and more. You can follow him on Twitter","sameAs":["https:\/\/www.facebook.com\/pages\/WebDesignDev\/109134615846988","https:\/\/twitter.com\/https:\/\/twitter.com\/WebDesignDev"]}]}},"_links":{"self":[{"href":"https:\/\/webdesigndev.com\/wp-json\/wp\/v2\/posts\/995"}],"collection":[{"href":"https:\/\/webdesigndev.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webdesigndev.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webdesigndev.com\/wp-json\/wp\/v2\/users\/30"}],"replies":[{"embeddable":true,"href":"https:\/\/webdesigndev.com\/wp-json\/wp\/v2\/comments?post=995"}],"version-history":[{"count":0,"href":"https:\/\/webdesigndev.com\/wp-json\/wp\/v2\/posts\/995\/revisions"}],"wp:attachment":[{"href":"https:\/\/webdesigndev.com\/wp-json\/wp\/v2\/media?parent=995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webdesigndev.com\/wp-json\/wp\/v2\/categories?post=995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webdesigndev.com\/wp-json\/wp\/v2\/tags?post=995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}