If I register a widget on Twitter, I get the following code:
<a class="twitter-timeline" href="https://twitter.com/vinto60utd" data-widget-id="283564783750483968">Tweets by @vinto60utd</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>
If I put this code as it is on my page, I see the Twitter widget as I wanted. How do I render my widgets dynamically or on the execution of some event (like button click)?
Using a Twitter widget, you can show Twitter content on your website and engage your visitors.
Go to https://publish.twitter.com/. Enter the URL of the timeline you'd like to embed. Customize the design by specifying the height and theme (light or dark) to match your website. Copy and paste the code into the HTML of your website wherever you would like the timeline to appear.
Go to 'Sources' and connect your Twitter account. Choose which type of Twitter source of posts you want to connect: hashtag, mentions, or your Twitter account. Customize and moderate the widget. Copy and embed the code on your website.
use
twttr.widgets.load();
if you have loaded //platform.twitter.com/widgets.js already
In my situation I doing like this: replacing content of some empty or previously timeline filled block to new link like yours
<a class="twitter-timeline" href="https://twitter.com/vinto60utd" data-widget-id="283564783750483968">
Tweets by @vinto60utd</a>
then I call twttr.widgets.load();
and twitter do the rest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With