Embed Tweets Using Twitter widgets.js

Using createTweet(), programmatically embed multiple tweets on page. Finds all divs with a tweet class and id that contains a valid twitter ID and places an iframe within the div.

HTML

<script src="//platform.twitter.com/widgets.js"></script>
<div class="tweet" id="599202861751410688"></div>
<div class="tweet" id="598859527291797504"></div>

CSS

#tweet {
    width: 400px !important;
  }
 
  #tweet iframe {
    border: none !important;
    box-shadow: none !important;
  }

JavaScript

// based on http://ctrlq.org/code/19933-embed-tweet-with-javascript

	var tweets = jQuery(".tweet");
	
	jQuery(tweets).each( function( t, tweet ) { 

    var id = jQuery(this).attr('id');
 
    twttr.widgets.createTweet(
      "1082706904218886145", tweet, 
      {
        conversation : 'none',    // or all
        cards        : 'hidden',  // or visible 
        linkColor    : '#cc0000', // default is blue
        theme        : 'light'    // or dark
      });

    });