Last active
June 20, 2018 03:46
-
-
Save shamimmoeen/aacda233ebfa88298bfda0482748b422 to your computer and use it in GitHub Desktop.
Load WP Job Manager templates from theme/plugin using hook
This file contains hidden or 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 | |
add_action( 'job_manager_locate_template', 'my_theme_include_job_manager_templates', 10, 3 ); | |
if (!function_exists('my_theme_include_job_manager_templates')) { | |
/** | |
* Include modified job manager templates. | |
* | |
* @param mixed $template The template | |
* @param string $template_name The template name | |
* @param string $template_path The template path | |
* | |
* @return mixed | |
*/ | |
function my_theme_include_job_manager_templates($template, $template_name, $template_path) { | |
// check if the template name is job-submitted.php | |
if ($template_name === 'job-submitted.php') { | |
/** | |
* here we have the job-submitted.php file here my_theme/job_manager/job-submitted.php, | |
* we can also keep the template file inside a plugin. | |
*/ | |
$template = get_template_directory() . '/job_manager/' . $template_name; | |
} | |
return $template; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment