• Hello,

    I just updated to 3.4 and I cannot get twitter embeds to work. I went to the twenty-eleven theme and disabled all plugins, thinking there was a conflict, but I still get just the URL displayed on the post. I have emptied the browser cache and tried a different browser just in case (Chrome and Safari)

    I’ve tried it with both the http and https, for example:

    and

    Any clue what could be going on here?

    Thanks

Viewing 15 replies - 1 through 15 (of 26 total)
  • A bit of a guess here, but embeds never seem to work for me.

    I find that when I go to edit the post (whether a twitter or a youtube embed), I switch over to html view and the URL has been auto wrapped by a link, so it looks like:

    <a href="https://twitter.com/BarackObama/status/213085892846424067">https://twitter.com/BarackObama/status/213085892846424067</a>

    And it just displays as a link. If, while in html mode, I manually delete the wrapper so it’s just my original URL again, and publish, my embeds work fine.\

    Give that a try and see if it helps perhaps?

    ^ that should do the trick.

    My problem with the new Twitter embeds in WP 3.4 is that they have a set width, which conflicts with the dimensions of the content area on my site. So, all embedded tweets get cut off by 20 pixels or so.

    Anyone else come across this?

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I’ve just pasted the two URLs you’ve put there into my test install. Both works fine for me. I did have to paste them in via the HTML editor because Windows included all the HTML. But it worked.

    I’m on 3.4 and I don’t have any plugins and I’m using the Twenty Eleven theme.

    Try wrapping them in [embed] like so, see if that helps.

    [embed]https://twitter.com/BarackObama/status/213085892846424067[/embed]
    
    [embed]https://twitter.com/BarackObama/status/213085892846424067[/embed]

    @jan: any idea on the width issue?

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Many! Or so I think. ??

    Is there a link that can be shared so I can see by example the width problem?

    Looks like the width is set to 550px inline on the tweet wrapper (id=twitter-widget-0 and class=twitter-tweet-rendered).

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Yep, and after looking I found where it can be filtered too. Otto wrote about it in a comment.

    https://ottopress.com/2011/twitter-adds-oembed-adding-it-to-wordpress-with-a-snippet/comment-page-1/#comment-10327

    This works.

    https://pastebin.com/Gz1Kaz8J

    add_filter('oembed_result','twitter_no_width',10,3);
    function twitter_no_width($html, $url, $args) {
            if (false !== strpos($url, 'twitter.com')) {
                    $html = str_replace('width="550"','width="200"',$html);
            }
            return $html;
    }

    Add this to your theme’s functions.php file (make a backup copy first) and play with that width="200" value.

    The oembed_result happens once, so edit and save your post to update the oembed cache if you make changes to the width.

    Edit: Your .hentry-middle is 460px, so try around that value to make it fit.

    Awesome! Worked like a charm.

    Thanks for the help, Jan.

    Thread Starter justted

    (@justted)

    Thanks for all the help – I am finding though that sometimes the embeds work, sometimes they don’t.

    Putting an [embed] tag in front just turns the text into a hyperlink.

    Is anyone else having this problem?

    I’ve turned off all plugins and gone to the stock theme and it’s still happening – some posts the embed takes some it doesn’t. Is this a Twitter api problem?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I think it’s actually your browser. I never have the problem on Chrome, I always have it on Safari.

    Thread Starter justted

    (@justted)

    I just tried it with Chrome, and the problem persists.

    I can actually come back after a few hours, put up a post with a twitter link, that does embed correctly, and then try again a few hours later and it does not, with no changes to the blog settings.

    Pasting the embed code from twitter.com works fine, so I can use that in the meantime.

    Any other ideas as to what’s going on?

    I’m on Dreamhost with Cloudflare by the way. I put things in developer mode to turn off caching to see if that made a difference, it didn’t.

    Hi justted,

    Had the exact same problem and this resolved it for me…

    On your admin dashboard go to Settings > Media

    Under the ‘Embeds’ title make sure Auto-Embeds is ticked. Pasting twitter urls should now work just like pasting youtube, vimeo and flickr urls. More info here – https://codex.www.ads-software.com/Embeds

    Hope this works for you! ??

    If anyone is interested in a responsive option for twitter embeds until they come up with an answer I came up with an option here https://sanerdesign.com/2012/07/twitter-embed-width-issue-wordpress-fix/

    It’s just a small bit of js that waits 100ms and then removes the inline style that Twitter adds

    Hope it helps someone

    For what it’s worth. I was having the same problem. No matter what I did, pasting a tweet into a new post would not get formatted. Out of desperation I went in to Settings -> Media. The auto embed box was checked.

    But I unchecked the box, saved my settings, checked the box again, saved my settings again. And it has worked for me ever since.

    FWIW

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘Twitter embeds not working in 3.4’ is closed to new replies.