Fandom

Wikia Developers Wiki

TwittWidget

889pages on
this wiki
Add New Page
Talk0 Share
Nuvola apps kservices This article is about a system or feature that is no longer in use.
  • The page is retained for historical reasons.

About

The TwittWidget script allows users to embed their own twitter feed or other twitter widget. You may find and configure Twitter widgets via your widget menu. This gadget consists of three parts. The code that goes in your wikis Common.js. The second you have to copy the template code found below which goes into a template named Twitter.

Installation 

To set up TwittWidget on your wiki you must first add:

importScriptPage('TwittWidget/code.js', 'dev');

or if you are using importArticles:

'u:dev:TwittWidget/code.js'

To your sites Common.js page (i.e. MediaWiki:Common.js).

Then create a template called Twitter (i.e. Template:Twitter) and add the following code:

<includeonly><onlyinclude><span class="twitter-name" style="display:none">{{{Twitter-Name|Null}}}</span><span class="twitter-code" style="display:none">{{{Twitter-Embed-Code|Null}}}</span><div id="twitter-container">Loading...</div><verbatim>TwitterUI</verbatim></onlyinclude></includeonly>
     <h3>DOC:</h3> To use: 
      
      Twitter-Username: Your username like @wikia but remove the "@"
      
      Twitter-Embed-Code: Your twitter widgets embed code (i.e. 9834543535345) you can get from [https://twitter.com/settings/widgets here]. It will be somewhere in the code encased in "".

Configuration

To add your feed to your userpage you must first visit here and create your own widget. Once created you will get an embed code like this:

<a class="twitter-timeline" href="https://twitter.com/Princess_Plat" data-widget-id="351117931377197057">Tweets by @Princess_Plat</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>

What you will need is the "data-widget-id", this number is the embed code you need for the template. You ONLY need the string of numbers. (Note: when adding it to the template make sure there are no spaces after it. Having a space breaks the template.)

The next part you need is your username (i.e. Princess_plat) Make sure you remove the "@". After you have entered these two pieces of information you click publish and your widget will auto embed into the page.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.