Wordpress does not load .php file into iframe

0

I have a .php file that includes HTML content in my ftp of the hosting, which I want to insert in the form of an iframe within a wordpress page.

If I do this with a pure HTML file, it always works when I insert it:

<iframe src="https://www.mipagina.com/wp-content/themes/mitema/assets/micarpeta/miarchivo1.html" frameborder="0" scrolling="no" width="(ancho)" height="(alto)"></iframe> 

If I do this otherwise with the PHP file, the iframe does not appear:

<iframe src="https://www.mipagina.com/wp-content/themes/mitema/assets/micarpeta/miarchivo2.php" frameborder="0" scrolling="no" width="(ancho)" height="(alto)"></iframe> 

Does anyone have any idea what can be done or how to solve it?

Thank you very much in advance. :)

    
asked by nice_guy 06.05.2017 в 17:45
source

1 answer

0

There must be some problem with the file path or with the way you are trying to present it.

I have done several tests in the following way and they all work :

In the file that opens through the URL:

(a). Testing from files via SFTP:

PROOF 1a:

archivo.php

$iframe='<iframe src="ruta/carpeta/valida/mi-iframe.php" frameborder="0" scrolling="no" width="(ancho)" height="(alto)"></iframe>'; 
echo $iframe;

Result : works. Show in iframe all the contents of the file mi-iframe.php

PROOF 2a:

archivo.php

$iframe='<iframe src="http://mi-sitio.com" frameborder="0" scrolling="no" width="(ancho)" height="(alto)"></iframe>'; 
echo $iframe;

Result : works. Show iframe the home page of my site.

(b). Tests from Wordpress directly:

PROOF 1b:

new wp post

<iframe src="http://www.mi-sitio.com/ruta/carpeta/valida/mi-iframe.php" frameborder="0" scrolling="no" width="(ancho)" height="(alto)"></iframe>

Result : works. Show in iframe all the contents of the file mi-iframe.php

TRIAL 2b:

new wp post

<iframe src="http://mi-sitio.com" frameborder="0" scrolling="no" width="(ancho)" height="(alto)"></iframe>

Result : works. Show iframe the home page of my site.

(c). try Embeds

Wordpress gives the possibility of embedding multimedia content in this way.

[embed width="123" height="456"]https://youtu.be/LMchhs_REzg[/embed]

Result: As my content was not multimedia, I tried a Youtube video, and it works.

    
answered by 06.05.2017 в 20:33