dongmaqiu6084 2014-12-03 04:10
浏览 18
已采纳

将PHP页面添加到wordpress

I have a HTML form that user can interact with and insert the data to a database. ( One HTML form and about 3 pages .php ) I need to implement this form to a word press page. I created a page in wordpress and it gives me a blank area to write my content but i don't know where i put my files. so appreciate your support to help me , thanks .

  • 写回答

2条回答 默认 最新

  • duanlinpi0265 2014-12-03 04:19
    关注

    Where you place your files depends greatly on the structure of your wordpress template. If you want to make a page that can be accessed via a url like "www.yourdomain.com/form", then you can make a "Page" in Wordpress (via the "Page" panel via the dashboard), and name it "Form" and then, in your form's HTML (or PHP) file, set your HTML up as a template using this syntax:

    Put this at the very top of your PHP page that contains your form's HTML/PHP:

    <?php
    /*
    Template Name: My Form Page
    */
    

    The code comment above is something wordpress will look for exclusively, and tells the wordpress engine that this page (your form HTML) is now a template named 'My Form Page'. So now, in the Wordpress Page editor for your "Form" page, you can attach your new template to your newly-created "Form" page by selecting "My Form Page" from the Template Dropdown in the Page editor.

    Here is a screenshot of what the "Template Dropdown" looks like (per the Wordpress documentation):

    Here is a screenshot of what the "Template Dropdown" looks like:

    After you follow these steps, navigating to this page will reveal your form's HTML, instead of a blank page.

    You should refer to the Wordpress documentation on Page Templates for more information:

    Hope this helps!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部