Limit number of tweets in Tumblr -


i'm using twitter block in tumblr displays latest tweets twitter feed. right displays last 20 tweets want show last 5 tweets. have idea how can that?

the code i'm using right below. tried changing .length variable 5 in loop, didn't anything:

 {block:twitter}     <div id="twitter" style="display:none;">         <h3><a href="http://twitter.com/{twitterusername}">latest tweets</a></h3>          <div id="tweets"></div>     </div>      <script type="text/javascript">         function recent_tweets(data) {             (i=0; i<data.length; i++) {                 document.getelementbyid("tweets").innerhtml =                     document.getelementbyid("tweets").innerhtml +                     '<a href="http://twitter.com/{twitterusername}/status/' +                     (data[i].id_str ? data[i].id_str : data[i].id) +                     '"><div class="content">' + data[i].text +                     '</div></a>';             }             document.getelementbyid("twitter").style.display = 'block';         }     </script> {/block:twitter} 

not sure how changed variable, should work:

<script type="text/javascript">     function recent_tweets(data) {         (i=0; i<5; i++) {             document.getelementbyid("tweets").innerhtml =                 document.getelementbyid("tweets").innerhtml +                 '<a href="http://twitter.com/{twitterusername}/status/' +                 (data[i].id_str ? data[i].id_str : data[i].id) +                 '"><div class="content">' + data[i].text +                 '</div></a>';         }         document.getelementbyid("twitter").style.display = 'block';     } </script> 

update

you'll need remove 2nd recent_tweets function calling. 1 change i<5 being overwritten 1 being called later in theme file.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -