In my theme directory I have the following structure:
/includes/functions-custom.php
/includes/avatax/AvaTax.php
/includes/classes/gmaps.class.php
I’m making a call from the functions-custom.php to include the second file within the WordPress admin using this code
require_once('avatax/AvaTax.php'); //Avalara Sales Tax API
if ( is_admin() ) {
require_once('classes/gmaps.class.php');
}
The first require applies to both the theme and to the admin. The second, obviously, only applies to the admin. However, the first require fails with the following message:
Warning: require_once(/Users/philipdowner/Sites/dms/wp-content/themes/dms/includes/avatax/classes/BatchSvc/WP_User_Search.class.php) [function.require-once]: failed to open stream: No such file or directory in /Users/philipdowner/Sites/dms/wp-content/themes/dms/includes/avatax/AvaTax.php on line 23
Fatal error: require_once() [function.require]: Failed opening required '/Users/philipdowner/Sites/dms/wp-content/themes/dms/includes/avatax/classes/BatchSvc/WP_User_Search.class.php' (include_path=".:/Applications/MAMP/bin/php5/lib/php") in /Users/philipdowner/Sites/dms/wp-content/themes/dms/includes/avatax/AvaTax.php on line 23
I don’t feel like this should be such a stumper. Perhaps I’m overlooking something obvious? I’ve tried preceding the file path with the constant ‘TEMPLATEPATH’ and using the obvious WordPress functions like
require_once(get_template_directory().'/path/to/file');
I’m developing locally on MAMP. Particularly odd is the call to the file (in the error message) ‘/classes/BatchSvc/WP_User_Search.class.php’.
Can anyone help?