I want to use a class file in a WordPress page template, but after adding the require_once() method, and trying to instance the class, I got
Fatal error: Class 'ClassName' not found,
the class file is displayed as html to the output page.
Any idea why this is happening? (I put the page template file and the class file under the theme directory)
Try:
require_once(TEMPLATEPATH . '/ClassName.php');Edit: Sorry, the file apparently has been found correctly. So then you need the class to be defined in that file looking like this:
$obj = new ClassName();?