Skip to content

Instantly share code, notes, and snippets.

@shamimmoeen
Last active June 20, 2018 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shamimmoeen/aacda233ebfa88298bfda0482748b422 to your computer and use it in GitHub Desktop.
Save shamimmoeen/aacda233ebfa88298bfda0482748b422 to your computer and use it in GitHub Desktop.
Load WP Job Manager templates from theme/plugin using hook
<?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