Is there any way to limit tweets in Twitter timeli

2019-04-06 11:07发布

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条回答
2楼-- · 2019-04-06 11:55

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.

查看更多
\"骚年 ilove
3楼-- · 2019-04-06 12:02

Hi you can set your links as 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">

For more info you can see ref. example here: http://blog.adlivetech.com/how-to-get-limited-twitter-feeds-in-website/

查看更多
登录 后发表回答