I'm currently working on a wordpress onepager and I want to open all wordpress posts in an iframe. This works fine, but the header and footer still appear in this iframe.
我目前正在开发一个wordpress onepager,我想打开iframe中的所有wordpress帖子。这工作正常,但页眉和页脚仍然出现在此iframe中。
In WordPress' single.php there are these two lines:
在WordPress的single.php中有以下两行:
<? get_header(); ?>
<? get_footer(); ?>
If I delete them, header and footer are gone, which is great, but as soon as I open the link directly and not in an iframe it looks totally naked without stylesheet, header, etc.
如果我删除它们,页眉和页脚都不见了,这很好,但是一旦我直接打开链接而不是iframe它看起来完全没有样式表,标题等等。
Is it possible - maybe with php - to remove these two lines ONLY if the site is being loaded in an iframe?
有可能 - 也许用php - 只有在iframe中加载网站时才能删除这两行吗?
1 个解决方案
#1
the url you are using in the iframe: I'm assuming it's would be something like single.php Change it to single.php?iframe=yes.
您在iframe中使用的网址:我假设它会像single.php一样将其更改为single.php?iframe = yes。
OR If you have single.php?id=whatever
Then change it to single.php?id=whatever&iframe=yes
或者如果您有single.php?id = whatever然后将其更改为single.php?id = whatever&iframe = yes
in single.php use
在single.php中使用
if (!isset($_GET["iframe"]) get_header();
if (!isset($_GET["iframe"]) get_footer();
#1
the url you are using in the iframe: I'm assuming it's would be something like single.php Change it to single.php?iframe=yes.
您在iframe中使用的网址:我假设它会像single.php一样将其更改为single.php?iframe = yes。
OR If you have single.php?id=whatever
Then change it to single.php?id=whatever&iframe=yes
或者如果您有single.php?id = whatever然后将其更改为single.php?id = whatever&iframe = yes
in single.php use
在single.php中使用
if (!isset($_GET["iframe"]) get_header();
if (!isset($_GET["iframe"]) get_footer();