URLs in iframes in Wordpress site


#1

Hi – I’m probably doing something obviously wrong, so I apologize in advance if this is a boneheaded question. I’m trying to insert a twitter button into a post a Wordpress site, which displays the post in both its individual post page and also on the home page. I’m inserting the button as an iframe.

The issue comes in with the URL. The Twitter button on the post page collects the correct URL to display, but when I place the same Twitter button under the post displayed on the homepage, in the popup, it displays the homepage URL instead of the post URL.

This is what I have on both the post page and the home page:

iframe allowtransparency="true" frameborder="0" scrolling="no" src="//platform.twitter.com/widgets/tweet_button.html" style="width:100px; height:20px;" url="<?php the_permalink(); ?>"

My instinct is that “url=” is not working for iframes and that the twitter button is instead just collecting the information from somewhere else. I tried filling in url=“http://www.google.com” and it still just displays my homepage URL in the popup. Is there something wrong with how I’m trying to pull in the URL?

Any help would be much appreciated! Thanks!


#2

Try using:

iframe allowtransparency="true" frameborder="0" scrolling="no" src="//platform.twitter.com/widgets/tweet_button.html?url=<?php the_permalink(); ?>" style="width:100px; height:20px;"

instead.


#3

Tried his; Not working for me. iframe markup correctly includes the URL, but Twitter isn’t including the URL in the message.


#4