Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you embed latest tweet on a website?

Tags:

twitter

On a site I'd need it to show the latest tweet from an account.

Previously, going to Twitter's Goodies page and limiting to one tweet, would accomplish this. Now there new version of Timeline embeds do not seem to have an option for this, so how is it accomplished? I can use the old version 1 embed I have saved but all old ones will stop working next year according to Twitters FAQs, so want to use the new version 1.1 code..

Below is the new code Twitter provides. Just need to know how/where to add "count=1" as I could with the original version.

<a class="twitter-timeline" href="https://twitter.com/example" data-widget-id="0000000000">Tweets by @example</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
like image 765
cchiera Avatar asked Oct 15 '12 00:10

cchiera


People also ask

How do you embed a tweet into a website?

Click the icon located within the Tweet. From the menu, select Embed Tweet. This will open publish.twitter.com where you can customize the look of the embedded Tweet by clicking set customization options.


1 Answers

Here is how to display the latest n tweets. Just change the value in data-tweet-limit.

<a class="twitter-timeline" href="https://twitter.com/twittername" data-tweet-limit="1"> Tweets by @twittername</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

like image 187
William Macdonald Avatar answered Oct 23 '22 00:10

William Macdonald