Reputation: 5980
I wrote a bunch of functionality (3 function files, search.php, query.php and vcard.php) I'm trying to bring their functionality into my Wordpress theme. Once brought into the WordPress themes root folder I get 404 errors when I try to call the functions as I did on the test site no matter what I do. ie ../, /, ./, etc.
Do I HAVE TO put my functions inside functions.php? Do I have to register my function files? Any help would be great! Thanks.
Upvotes: 0
Views: 533
Reputation: 6777
You can include the files from functions.php. You define the constant OF_FILEPATH based on whether or not you are in a child theme or a parent theme and then use it to load in the included php files which you place in an 'includes' directory in your theme's root;
In functions.php;
if ( STYLESHEETPATH == TEMPLATEPATH ) {
define('OF_FILEPATH', TEMPLATEPATH);
} else {
define('OF_FILEPATH', STYLESHEETPATH);
}
require_once (OF_FILEPATH . '/includes/search.php');
require_once (OF_FILEPATH . '/includes/query.php');
require_once (OF_FILEPATH . '/includes/vcard.php');
That should work for you.
Upvotes: 1