Add additional functions file instead of functions.php

I was wondering if i could have more than one functions file in wordpress and how do I call these actions in for example

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
Add a comment  | 

1 Answer 1

Reset to default 1

You 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

相关推荐

  • Add additional functions file instead of functions.php

    I was wondering if i could have more than one functions file in wordpress and how do I call these actions in for example

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信