I'm creating a wordpress theme and am having trouble generating a video link to go into an iframe source. I've tried troubleshooting and it seems that the issue is beyond wordpress and I can't actually input any link with PHP to work with iframe. Here's an example for simplicity's sake.
<iframe src="<?php echo 'https://vimeo.com/159120552'; ?>" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
The PHP works as far as I can tell (when I inspect it, the link is in the correct place), but there appears to be a blank web document created in the iframe instead.
Am I doing something wrong or is this a known issue of iframe and PHP?
This issue not related to PHP . Its throwing an error refused to display in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Please refer How to set 'X-Frame-Options' on iframe?
Related
I have been trying ot hunt this down all afternoon, Im pretty new to all this and am building my first site with php
what Im trying to do is I have a google maps embed code stored in a Db which I have assigned to a variable $map, I want to inject the embed code into an existing div.
So basically a click here for map. I may be way off on what I can do here.
Im sure there is a fancier way to do this but Im just learning and trying something simple.
Sorry if this is something that is obvious.
I have no code to show as i have murdered it and it is an unhelpful mess now.
If the page has already been served to the user, you'll need to use javascript to update the div, or reload the page. I jQuery's .post method to dynamically refresh divs with using AJAX. Info at http://api.jquery.com/jQuery.post/.
I use the following code on my website, which sounds similar to what you're trying to do, but in my case, I'm passing the address to the embed code in the $addresssubjectfullgoogle variable:
<iframe width="100%"
height="350"
frameborder="1"
scrolling="no"
marginheight="0"
marginwidth="0" src="
https://maps.google.com/?f=q&t=h&ie=UTF8&output=embed&q=<?php echo $addresssubjectfullgoogle;?>&z=18&ll=<?php echo $addresssubjectfullgoogle;?>&ie=UTF8">
</iframe>
I suspect that you could do something similar except that in your case, the same could might look something like this:
<iframe width="100%"
height="350"
frameborder="1"
scrolling="no"
marginheight="0"
marginwidth="0" src="<?php echo $map;?>">
</iframe>
I hope that's helpful.
I'm trying to embed a vimeo player in my Wordpress 3.8 site. To make changing the video a little easier, I've created Page which just contains the url for a Vimeo video. On the site, I try to embed the video like so:
<iframe allowfullscreen="" frameborder="0" mozallowfullscreen="" src="<? echo apply_filters('the_content', get_page(925)->post_content); ?>" webkitallowfullscreen=""></iframe>
But when I view the site, it just loads an empty page template inside the frame! When I echo that php chunk outside the iframe, however, it returns the url as expected. Putting in the url directly causes it to work fine, and I've tried a ton of quotation configurations to make sure the error wasn't there. Any idea what is causing it to wig out?
why are you running apply_filters on this? Also, get_page is deprecated.
Try something like this:
<?php
$vidPost = get_post(925);
echo '<iframe allowfullscreen="" frameborder="0" mozallowfullscreen="" src="'.$vidPost->post_content.'" webkitallowfullscreen=""></iframe>';
?>
I am trying to programmatically include a tweet button, in an iframe, on a page. I want this to tweet the wordpress shortlink of a specific post.
I am using PHP to insert into my wordpress database the following HTML iframe code to include the weet button. The code looks like this
'<iframe allowtransparency="true" frameborder="0" scrolling="no"
src="https://platform.twitter.com/widgets/tweet_button.html
?count=horizonatal?url=http://www.mywebsite.com?p= '
. $post_id . '"></iframe>'
As you can see I am concatenating the $post_id, which is in the PHP code, with the rest of the wordpress shortlink "http://www.mywebsite.com?p=". The problem appears to be that the twitter widget interprets the '?' in my url attribute as a query for itself -- as opposed to a query for my wordpress site - and what happens is I can only get http://www.mywebsite.com tweeted.
Does anyone know a way around this?
You need use urlencode:
'<iframe allowtransparency="true" frameborder="0" scrolling="no"
src="https://platform.twitter.com/widgets/tweet_button.html
?count=horizonatal?url='.urlencode('http://www.mywebsite.com?p='.$post_id)
.'"></iframe>'
Reading: http://www.php.net/urlencode
I have a web site I'm working on and for some reason some of my videos don't display. The first videos display but the next one's don't.
So first one looks like this:
And the rest look like this:
I know the url's I am using are correct, I dump them to the screen and navigated to them to make sure they weren't broken. This is in chrome, same thing happens in IE.
This is the code I am using to embed:
<iframe width="420" height="315" alt="Jesus Culture" src="<?=$row?>"
frameborder="5" allowfullscreen></iframe>
I'm using similar code to yours for multiple videos on one page,
i.e.
<iframe width="425" height="349" src="http://www.youtube.com/embed/video-code" frameborder="0" allowfullscreen=""></iframe>
Make sure that your urls have the embed format. Also try to place the src value hardcoded (no php) to check whether in that case displaying multiple videos on the page will be an issue.
I am trying to show a google map using the following code:
<embed height="400" width="600" src="http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=110069293083852065946.00047e2506156dd8d127b&ll=27.727526,85.310855&spn=0.021197,0.038581&z=14&iwloc=00047e251edcecb28ba7c&output=embed">
It works fine and shows the map correctly in my chrome browser by it shows missing plugin in firefox browser.
What is wrong with this? Is the code itself wrong?
Try using an iframe, not sure where that embed tag came from.
<iframe width="400" height="600" src="http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=110069293083852065946.00047e2506156dd8d127b&ll=27.727526,85.310855&spn=0.021197,0.038581&z=14&iwloc=00047e251edcecb28ba7c&output=embed"></iframe>
There's plenty of documentation on this:
http://code.google.com/apis/maps/documentation/javascript/basics.html
I've never seen it use embed, usually you just create it using JavaScript assign it to a div tag.