I'm working on a plugin that needs to check in the stylesheet directory for a file, if it doesn't exist there, the template directory, and if its not there, it defaults to the plugin's directory.
This seems like it should be simple, but for some reason I'm having trouble making it work.
Here's the code:
/* Loads the options array from the theme */
if (file_exists( STYLESHEETPATH . '/functions.php' ) ) {
require_once STYLESHEETPATH . '/options.php';
}
else if (file_exists( dirname( __FILE__ ) . '/options.php' ) ) {
require_once dirname( __FILE__ ) . '/options.php';
}
Also, please let me know if this can be done in a more elegant way. Thanks.