Last active
July 22, 2021 14:11
-
-
Save EdwardBock/8c1f2793dc03fee4112d6e7ffcd58dad to your computer and use it in GitHub Desktop.
Parent theme template path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace PublicFunctionOrg\WordPress; | |
class Templates { | |
private $theme_dir = "/my-plugin-templates/"; | |
public function get_template_path($template){ | |
$path = $this->theme_dir.$template; | |
if( is_file( get_template_directory().$path)){ | |
return get_template_directory().$path; | |
} | |
return false; | |
} | |
} | |
$templates = new Templates(); | |
$filepath = $templates->get_template_path("my-template.php"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment