0

I have a child theme folder called themes/child-theme and inside I have a file dashboard_payments.php. Under the child theme folder I'm creating a new folder called gateway and inside there's a config.php.

So, how do I do a require_once inside dashboard_payments.php to call the file gateway/config.php? How would the require_once or include line look like?

1
  • Why would you need to do this? – Jeff W Jul 19 '20 at 4:12
0

Since 4.7 get_theme_file_path() is the right function to use:

require_once get_theme_file_path( 'gateway/config.php' );
0

You can use either

require_once(get_stylesheet_directory() . '/gateway/config.php');

or (should be faster)

require_once(__DIR__ . '/gateway/config.php');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.