【问题标题】:WordPress iframe content now showingWordPress iframe 内容现在显示
【发布时间】:2017-06-09 10:56:18
【问题描述】:

我正在尝试显示一些 WP 内容,但只显示静态文本。根本没有出现 WP 内容。 查看开发工具源代码,似乎没有加载任何 WP 脚本?

非常感谢我错过的任何帮助。

这是我在 page.php 中的调用:

<iframe src="http://www.xxxxxx.com/wp-content/themes/themename/iframe-gview.php" width="100%" height="500" frameBorder="0"></iframe>

我的php模板代码:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Applications</title>
<?php wp_head(); ?>
</head>
<body>
<link rel="stylesheet" type="text/css" href="http://www.xxxxxx.com/wp-content/themes/themename/assets/css/style.css">

    Static Content

    <?php
        echo do_shortcode('[gravityview id="1234"]');
    ?>

<?php wp_footer(); ?>   
</body>
</html>

【问题讨论】:

  • iframe 中的错误是什么?
  • 更新了我在@vel上面的解释
  • 您是否从任何其他站点访问此 URL http://www.xxxxxx.com/wp-content/themes/themename/iframe-gview.php
  • 是的。如果您直接访问模板 url,wordpress 不会将其视为模板。
  • 是的。或者你应该在你的文件中包含require_once('../../../wp-load.php');

标签: wordpress iframe


【解决方案1】:

正如上面提到的@vel,这解决了我的问题:

<?php require_once('../../../wp-load.php'); ?>

【讨论】:

    猜你喜欢
    • 2012-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-18
    • 2013-11-20
    • 2017-10-09
    相关资源
    最近更新 更多