dqwr32867 2019-07-28 14:43
浏览 84

如何将带有ajax请求的php页面添加到wordpress中的另一个php?

I have two php files- index.php ajax.php

The index.php file contains html, javascript and css along with bootstrap and jquery library.

These are my previous website pages, which are stand-alone, single page website.

How can I add these to a wordpress site so that when the user visits a link, it shows content of index.php and from index.php, the jquery search to ajax.php is performed?

I tried making custom templates and created a page with it, but it does not search for ajax.php file for the ajax requests.

How can I do it? I am a developer myself, I understand PHP, but not the wordpress cms.

  • 写回答

1条回答 默认 最新

  • doudou32012 2019-07-28 15:09
    关注

    There are two approaches. You can either change index.php to another file, say, "search.php", and it will co-exist with Wordpress and everything will work.

    Or, you can "transplant" your index.php into the Wordpress eco-system:

    1. create a "page" in wordpress so that you'll have a container.
    2. in "functions.php", create a custom shortcode with the add_shortcode function. (you could create a plugin as part of the theme so that when you upgrade Wordpress your changes stay compatible, but for now you can just change functions.php)
    3. in the content of the new page, use the shortcode.

    You can move the jQuery code, HTML markups, etc. into the definition of the shortcode. You might run into some styling collisions but for the most part it should work.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?