如何在wordpress中添加自定义php include()文件

时间:2021-11-06 21:12:17

In my wordpress theme, there is a page name pre-registration. if I take there any HTML form, that work but I need a congig.php file for MySQL query for this page. Please help me to add a include(); file at that page.

在我的wordpress主题中,有一个页面名称预注册。如果我把任何HTML表单,那工作,但我需要一个congig.php文件用于MySQL查询此页面。请帮我添加一个include();该页面上的文件。

1 个解决方案

#1


1  

If It is not a template and you are making something like plugin or your code is directly or indirectly belongs to fucntions.php you can use include as you do in core PHP. If It is an template part use get_template_part() instead , if you can see some error or you have noticed nay problem, please let me know.

如果它不是模板而你正在制作类似插件的东西,或者你的代码直接或间接属于fucntions.php,你可以像在核心PHP中一样使用include。如果它是模板部分,请使用get_template_part(),如果您看到某些错误或者您注意到了某个问题,请告诉我。

#1


1  

If It is not a template and you are making something like plugin or your code is directly or indirectly belongs to fucntions.php you can use include as you do in core PHP. If It is an template part use get_template_part() instead , if you can see some error or you have noticed nay problem, please let me know.

如果它不是模板而你正在制作类似插件的东西,或者你的代码直接或间接属于fucntions.php,你可以像在核心PHP中一样使用include。如果它是模板部分,请使用get_template_part(),如果您看到某些错误或者您注意到了某个问题,请告诉我。