16

I am using Twitter's timeline widget seen below and would like to limit the number of tweets to 5. It is 20 by default. The website this is being embedded into is for visually impaired people who use screen readers. Screen readers get trapped inside the widget and the user is forced to tab through all 20 tweets to get out. There is no instruction for changing the number in twitter's documentation. I would be open to using other code. Thanks!

<a class="twitter-timeline" data-dnt="true" href="https://twitter.com/myprofile" data-widget-id="3007449998460120999">Tweets by @myprofile</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>

2 Answers 2

33

You can set data attributes to the <a> tag to customize the timeline. Look at the Embedded Timeline documentation for more options.

You'll want data-tweet-limit=5.

0
15

Hi you can set attribute in your link as data-tweet-limit="3"

for example.

<a class="twitter-timeline" data-lang="en" data-dnt="true" data-tweet-limit="3" href="https://twitter.com/AdliveTech">Tweets by AdliveTech</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.