How to embed a Twitter timeline on a Joomla website
How to limit the number of timeline entries displayed
There are many extensions that people can install that will add a Twitter timeline to their websites. I don’t want to deprive struggling software developers of their profit but do we really need additional software (some of which costs money) in order to do something quite simple? This article shows how to embed a Twitter timeline on a Joomla website without using any additional software.
The process is as easy as 1-2-3: obtain the URL of the Twitter timeline; copy the URL into the Twitter publish site; copy the generated code into your website It’s really that simple.
Step 1: Obtain the URL of the Twitter feed
For the purposes of this guide, we will use the Twitter timeline @Joomla: https://twitter.com/joomla.
Step 2: Use the Twitter publish site
The Twitter publish site is located at https://publish.twitter.com (see the image on the right; click to enlarge it). Using the image as a guide, paste the URL of the selected Twitter timeline into the textbox (indicated by ① in the image).
Below the input box are two links: click the Embedded Timeline link on the left as indicated by ②. Clicking this link will cause the page to scroll down automatically, revealing the required HTML code. Click the Copy Code button shown at ③.
The copied text is:
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
Step 3: Copy the code
The code, produced in step 2 above, can be pasted anywhere you would like. Perhaps the simplest way to implement an embedded Twitter timeline in a J! website is to create a module. Go to Extensions » Modules » New and then choose Custom. Paste the copied text as raw HTML in the editor, give the module a title, assign the module to a template position and menu items, publish the module and save it.
To see an example of a custom module that displays an embedded Twitter timeline, go to https://www.kuneze.com/about.
But wait, there's more
The embedded Twitter timeline produced with the above instructions will show all “tweets”. If you want to limit the number of timeline entries to, say, the latest four “tweets” you will need to modify the embed code by adding a data-tweet-limit tag, as follows:
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
To see an example of a custom module that displays an embedded Twitter timeline (limited to the latest three “tweets”), go to https://www.kuneze.com/about.