0

我使用的是默认的 TwentyEleven 主题,我在 sidebar.php 中添加了以下代码,但它不起作用(我收到 310 错误)

<iframe src="frame.html" name="test" height="600" width="180"></iframe>

iframe.html 位于 /themes/twentyeleven 文件夹中,因此它应该可以工作(至少在常规网站上)。

是否有必要使用某种小部件插件才能使其工作。什么可以阻止 iframe 出现在网站上?

谢谢你。

4

2 回答 2

0

您需要通过 http 请求而不是通过本地路径来访问文件。

<iframe src="<?php echo ( get_site_url() . '/wp-content/themes/twentyeleven/iframe.html' ); ?>" />
于 2016-01-31T20:49:26.167 回答
-1

您应该在给出路径之前使用 get_bloginfo('template_directory') ......尝试使用 {

<iframe src="<?php echo get_theme_root(); ?>/frame.html" name="test" height="600" width="180"></iframe>

}

尝试阅读此 http://codex.wordpress.org/Function_Reference/get_theme_root

于 2013-01-05T17:33:33.060 回答