问题描述
我在 wordpress 中使用 iframe,但 iframe 中的页面不支持 wordpress 功能.iframe 中的页面来自同一个域.
I am using an iframe in wordpress, but the page inside iframe not supporting wordpress functions.the page inside iframe is from the same domain.
这是我想要做的:我正在尝试通过 wordpress 函数调用 iframe 页面内的 css.以下是我如何使用 iframe 标签:
Here is what i am trying to do: I am trying to call a css inside iframe page via wordpress function. Below is how i am using iframe tag :
<iframe id="iframeBox" src="<?php echo get_template_directory_uri();?>/iframe/scoreboard_summary.php" sandbox="" FRAMEBORDER="no" ></iframe>
这是我页面中的 css 调用标记scoreboard_summary.php:
Here is the css calling tag in my page scoreboard_summary.php :
<link type="text/css" rel="stylesheet" href="<?php echo get_template_directory_uri();?>/style.css">
函数 get_template_directory_uri() 不起作用?
the function get_template_directory_uri() is not working ?
请让我知道我需要做什么?提前致谢.
Please let me know what should i need to do?Thanks in advance.
推荐答案
iframe 只是拉入并显示在 div 中的网页.你不能以这种方式与他们互动.PHP 已经吐出由您设置的循环和规则定义的内容.如果您想与服务器通信并每隔一段时间调出新数据并跳过 iframe,您可能需要查看 ajax 以获取类似的内容.
iframes are just webpages pulled in and shown in a div. You can't interact with them in that way. PHP has already spit out what was defined by the loops and rules you set. You would want to look into ajax for something like that if you want to talk to the server and bring up new data at an interval, and skip the iframe.
<?php echo 'do this thing' ?>
只是在页面加载后变成this thing
.没有什么可钩的.
<?php echo 'do this thing' ?>
just turns into this thing
after the page is loaded. There isn't much to hook into.
如果您只是想获取样式表并将其应用于您的页面,那么我建议获取该样式表的完整、标准、URL,并跳过模板目录 uri 等.
If you are just trying to get the stylesheet and apply it to you your page, then I would suggest getting the whole, standard, URL for that stylesheet and skip the template directory uri etc.
也许你可以用一些代码或这样的例子更好地解释它,它是一个每隔一段时间刷新的 iframe.祝你好运!
Maybe you can explain it better with some code or an example like this one, it's an iframe that refreshes at an interval. Good Luck!
http://jsfiddle.net/sheriffderek/3C9qP/
这篇关于Wordpress 函数在 wordpress 的 iframe 内不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!