0

I want to seperate my Option-Page functions and functions.php.
Therefore i moved Option-Page functions to another file "includes/options.php".
Including the file with require_once("includes/options.php") does not work anymore (I am absolutely sure that it worked in past), but require_once("includes/options.inc") is working.
When should i use *.inc files and when *.php files?
Especially when theme or plugin developing.

I have done same as here: Organizing Code in your WordPress Theme's functions.php File?

0

2 Answers 2

0

If you are editing theme files use get_template_directory to retrieve the php files. try the code below in your functions.php file.

require get_template_directory() . '/includes/option.php';
0
2

Never use relative paths to include PHP files, you just have no real idea relative to what it will end up being. Always find the location of your theme file by doing something like $rootdir = dirname(__FILE__) from your functions.php, and then use include($rootdir.'/includes/options.php')

1
  • Very helpful. Really good hint.
    – bunower
    Sep 23, 2016 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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