[resolved] Is there a Twitter widget / twitter timeline widget that actually works? (6 posts)

  1. Soukous
    Posted 3 years ago #

    I've been trying to put a Twitter widget in the sidebar of my blog but keep hitting snags.
    Is there one which actually works, without the need for scripting knowledge and endless buggering around?

  2. Shaun Scovil
    Posted 3 years ago #

    I grew tired of using Twitter widget plugins that didn't work, so I created a simple one of my own. It doesn't have any options on the WordPress back end, but you would need to follow these steps to make it work:

    1. Visit https://twitter.com/settings/widgets and create your Twitter Widget.
    2. Copy the code that it gives you, which should look something like the example below.
    3. Open the plugin file: simple-twitter-widget.php in any text editor and replace my Twitter widget code (on lines 42-43) with your own.

    I know having to edit the plugin code can be intimidating if you're not technical, but you really just need to do a find/replace and swap this:

    <a class="twitter-timeline" data-dnt="true" href="https://twitter.com/wp_shaun" data-widget-id="310167306028326913">Tweets by @wp_shaun</a>
    <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

    ...with the code you get from Twitter.

    Anyway, if you want to use it you can find it on GitHub and download it here.

  3. Soukous
    Posted 3 years ago #

    Thanks Shaun,

    I did all you specified and installed the widget.
    Unfortunately the only thing showing in the sidebar is the Title

    no Twitter username
    no posts

    what have I done wrong?

  4. 2ninerniner2
    Posted 3 years ago #

    I just pasted the code I got from Twitter into a plain, old Text widget and there was my feed :)

  5. Soukous
    Posted 3 years ago #

    you're a genius

  6. Shaun Scovil
    Posted 3 years ago #

    @Soukous: Sorry you were having trouble with the plugin; not sure what you were doing wrong without seeing what you did.

    With regard to the solution posted by @2ninerniner2 -- I'm glad that worked in your case. It should be noted, however, that only Admins (or Super Admins, in the case of WordPress Multisite) can post HTML markup and JavaScript in text widgets. It requires the unfiltered_html capability, so it might not be the right solution in all cases.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.