1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 How do I create BB code to embed tweets in posts?

Discussion in 'XenForo Questions and Support' started by TheBigK, Mar 11, 2014.

  1. TheBigK

    TheBigK Well-Known Member

    This question might be too naive; but I'm trying to explore the possibilities of embedding tweets in posts using custom BB codes supported by XF 1.3. Can someone describe what's the right way to make this work?
     
  2. Valhalla

    Valhalla Well-Known Member

    Put this in the <head> section of your template (bear in mind it is only required in the places you wish to display a message, so 'post' templates)

    Code:
    <script type="text/javascript" src="http://plataform.twitter.com/widgets.js"></script>
    Use this as the HTML replacement:
    Code:
    <blockquote class="twitter-tweet" width="370">[Javascript is not enabled. <a href="$1">Click here to view this on Twitter</a>]</blockquote>
    This will allow you to include an individual Twitter message by including the full link between two tags.
     
    Last edited: Mar 11, 2014
    TheBigK likes this.
  3. aempes

    aempes Member

    Can someone give me an example in which template I have to put the first code? I just want to display tweets in threads but I always get the message "Javascript is not enabled.".
     
  4. Valhalla

    Valhalla Well-Known Member

    There is a better way to achieve this by adding Twitter as a BB Code Media Site.

    There is an add-on somewhere that can add it for you: http://xenforo.com/community/resources/twitter-mediasite-bbcode.1390/

    I may be wrong, but by using the details above, the the Tweet will not parse if you use a quick reply (it would only display if you reload the page).
     
    ARSamo likes this.
  5. aempes

    aempes Member

    Do you mean this one? http://xenforo.com/community/resources/twitter-mediasite-bbcode.1390/
    It seems to be outdated. As a result I get this: http://puu.sh/8BDgM/865dc31b78.png
    And if I try to edit the post this errorlog pop up: http://puu.sh/8BDaS/f970a56a5d.png

    I've also tried to add the media site manually but I got the same issue. :/
     
  6. aempes

    aempes Member

    I've found the "issue". Isn't really one but nvm. :p

    If someone else has the same problem with Twitter MediaSite BBcode just delete the comment arrows in the bbms_twitter_XFormer template after the installation is complete.

    Should look like this:

    <!--<script src="//platform.twitter.com/widgets.js" charset="utf-8"></script>-->


    <!--

    If you have the twitter button deactivated and you want to use the official twitter
    oembed api + twitter widget.js to build the tweet remove the comment arrows right
    at the beginning and end of the first line..which would only leave the following

    example: <script src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

    -->



    <script>$(".twitter-tweet").css("border","1px solid {xen:property primaryLighterStill}");</script>
    <script>$(".twitter-tweet").css("border-radius", "7px");</script>
    <script>$(".twitter-tweet").css("box-shadow", "0px 0px 7px 0px {xen:property primaryDarker}");</script>
    <script>$(".twitter-tweet").children("p").css("border-bottom", "3px double {xen:property primaryLighterStill}"), ;</script>
     

Share This Page