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?

bunower
  • 3
  • 1

2 Answers2

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')

Mark Kaplun
  • 23,790
  • 7
  • 43
  • 65
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';
Anwer AR
  • 1,007
  • 11
  • 19