I’m creating a cpt plugin that will add ‘single-cpt.php’ in the theme directory.
The following code works but only if I put it in a functions.php (theme) folder.
// check if the file exists
$checkFile = locate_template('single-cpt.php');
if (!empty($checkFile)) {
echo "Found!";
} else {
echo "Not found";
}
How do I get the plugin check if the current theme has that single-cpt.php file ?
Go to Source
Author: Ash