Ejemplo n.º 1
0
/**
 * Get and include template files.
 *
 * @param mixed $template_name
 * @param array $args (default: array())
 * @param string $template_path (default: '')
 * @param string $default_path (default: '')
 * @return void
 */
function get_job_manager_template($template_name, $args = array(), $template_path = '', $default_path = '')
{
    if ($args && is_array($args)) {
        extract($args);
    }
    include locate_job_manager_template($template_name, $template_path, $default_path);
}
/**
 * Get template part (for templates in loops).
 *
 * @param string $slug
 * @param string $name (default: '')
 * @param string $template_path (default: 'job_manager')
 * @param string|bool $default_path (default: '') False to not load a default
 */
function get_job_manager_template_part($slug, $name = '', $template_path = 'job_manager', $default_path = '')
{
    $template = '';
    if ($name) {
        $template = locate_job_manager_template("{$slug}-{$name}.php", $template_path, $default_path);
    }
    // If template file doesn't exist, look in yourtheme/slug.php and yourtheme/job_manager/slug.php
    if (!$template) {
        $template = locate_job_manager_template("{$slug}.php", $template_path, $default_path);
    }
    if ($template) {
        load_template($template, false);
    }
}
 /**
  * Disable application form if needed
  */
 public function disable_application_form($template, $template_name)
 {
     global $post;
     if ('job-application.php' === $template_name && get_option('job_application_prevent_multiple_applications') && user_has_applied_for_job(get_current_user_id(), $post->ID)) {
         return locate_job_manager_template('application-form-applied.php', 'wp-job-manager-applications', JOB_MANAGER_APPLICATIONS_PLUGIN_DIR . '/templates/');
     }
     return $template;
 }