amy
amy

Reputation: 243

Is there any way to limit tweets in Twitter timeline widget?

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>

Upvotes: 16

Views: 15729

Answers (2)

Steven Lambert
Steven Lambert

Reputation: 5891

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.

Upvotes: 33

Rohit Kaushik
Rohit Kaushik

Reputation: 1302

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">

Upvotes: 15

Related Questions