WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Question re: Tweet Button with its Javascript for 3.5 (2 posts)

  1. Yael K. Miller
    Member
    Posted 1 year ago #

    First off, I don't know Javascript -- I can only do basic plug and play.

    My question: what is the best way to have Twitter's Tweet Button without a share button plugin?

    In Troubleshooting WordPress 3.5 Master List, Ipstenu said

    Plugins and themes which use their own jQuery without properly compensating for WP's will break. This isn't new by any means. In fact, we've always said that replacing or overriding jQuery will bust things

    I use the stand-alone Tweet Button using Twitter's code. Half of the time, the Tweet Button on my various websites isn't loading properly. Plus, I think it's affecting how the whole site loads.

    On my websites, I currently have the below in my functions.php:

    <script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
    <a href="http://twitter.com/share" class="twitter-share-button"
    data-text="<?php the_title(); ?>"
    data-count="none"
    data-via="MillerMosaicLLC">Tweet</a>

    I just checked out Twitter's Tweet Button page and it appears they've changed the script so the equivalent to the above using their new script would be this:

    <a href="https://twitter.com/share" class="twitter-share-button" data-via="MillerMosaicLLC" data-count="none" data-dnt="true">Tweet</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>

    There's also the iFrame option which is this (I think):

    <iframe allowtransparency="true" frameborder="0" scrolling="no"
    src="http://platform.twitter.com/widgets/tweet_button.html?text=<?php the_title(); ?>&url&via=MillerMosaicLLC&count=none&dnt=true"
    style="width:130px; height:20px;"></iframe>

    Which of the above three plays the best with WordPress 3.5? If none of them, what's a way to make them play better?

  2. Yael K. Miller
    Member
    Posted 1 year ago #

    Based on my testing, the first method is definitely slower. The second and third are about equal.

    In any case, I've decided to stop having a separate Tweet Button and use the rtSocial plugin.

Topic Closed

This topic has been closed to new replies.

About this Topic