I was wondering if i could have more than one functions file in wordpress and how do I call these actions in for example a registration form?
Thanks.
EDIT
This the process file im trying to post to that has the code that connects to db and adds new user to db. however this isnt working.do i need to include anything at the top of the page
I was wondering if i could have more than one functions file in wordpress and how do I call these actions in for example a registration form?
Thanks.
EDIT
This the process file im trying to post to that has the code that connects to db and adds new user to db. however this isnt working.do i need to include anything at the top of the page
Share Improve this question edited Jun 16, 2020 at 9:39 Louise Finch asked Jun 11, 2020 at 14:56 Louise FinchLouise Finch 211 silver badge3 bronze badges 1- The relative path here won't be relative to the template file when it gets included in something else, so that isn't going to work. You could switch that to be an absolute path to your registerProcess.php instead, but then you're calling a non-WP PHP file: it might be better to handle the post some other way. – Rup Commented Jun 16, 2020 at 10:03
1 Answer
Reset to default 1You can include multiple files in your functions.php
. I do this to keep things organized. All my functions are in a functions
subfolder, so my functions.php
file just looks like this:
require get_template_directory() . '/functions/function-1.php';
require get_template_directory() . '/functions/function-2.php';
require get_template_directory() . '/functions/function-3.php';
If you have functions you only want called on certain pages, for example, you can do this:
if ( is_page( 'registration-form' ) ) :
require get_template_directory() . '/functions/registration.php';
endif;
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742345259a4426416.html
评论列表(0条)