dongpu7881 2014-02-06 19:20
浏览 81
已采纳

在wordpress中加载iframe中的自定义页面

I am a noob with wordpress and I need a little help, as I think what I'm trying to do shouldn't be too difficult.

I added in one of the pages the necessary functions that render a form with an input text field and a submit button.

When then submit button is pressed I invoke a modal popup which contains another page which is just an html page but contains a form that posts to a php page.

Right now the content of the iframe is externally hosted and everything works fine. However, I haven't been successful in having the content of the iframe migrated locally within the wordpress directories.

I tried copying the html page into the plugins wordpress directory but the resources (images, javascript, css) will not load. I fear just dumping an html file won't be enough and that it needs to be done differently.

Any clues as to how to get this content to render? Does it have to be a new widget, or is this just a new page with a custom template or is there a quick and easy way to get wordpress to render that directory like a normal php directory?

Thank you

  • 写回答

1条回答 默认 最新

  • du1108 2014-02-06 20:40
    关注

    Have you checked the file you're trying to move to make sure it doesn't have hard-coded (absolute) references to its files? If it references a JavaScript file like so:

    <script src="/some-dir/js/script.js"></script>

    and you move the file to /wp-content/plugins/plugin-name/ then it would still be looking for the script file as if it were in the same directory as /wp-content/. Could be other reasons, but that would be my first suggestion to try. Change any absolute references to relative, that is from

    <script src="/some-dir/js/script.js"></script>

    to

    <script src="../js/script.js"></script>

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)