JPKCom ACF Jobs

template-loader.php

Template loader with override hierarchy

Handles template loading for single and archive views with support for:

  • Theme overrides (child/parent)
  • MU plugin overrides
  • Debug templates (when WP_DEBUG is enabled)
  • Template partials loading
Tags
since
1.0.0

Table of Contents

Functions

jpkcom_acf_jobs_locate_template()  : string|false
Locate template file with override support
jpkcom_acf_jobs_template_include()  : string
Template loader for singular and archive templates
jpkcom_acf_jobs_get_template_part()  : void
Load partial templates with full override support

Functions

jpkcom_acf_jobs_locate_template()

Locate template file with override support

jpkcom_acf_jobs_locate_template(string $template_name) : string|false

Searches for template files in this priority order:

  1. Child Theme: /wp-content/themes/your-child-theme/jpkcom-acf-jobs/
  2. Parent Theme: /wp-content/themes/your-theme/jpkcom-acf-jobs/
  3. MU plugin override: /wp-content/mu-plugins/jpkcom-acf-jobs-overrides/templates/
  4. Plugin itself: /wp-content/plugins/jpkcom-acf-jobs/templates/ (or debug-templates/ if WP_DEBUG)
Parameters
$template_name : string

Template filename (e.g., 'single-job.php' or 'partials/job/company.php').

Tags
since
1.0.0
Return values
string|false

Full path to template file if found, false otherwise.

jpkcom_acf_jobs_template_include()

Template loader for singular and archive templates

jpkcom_acf_jobs_template_include(string $template) : string

Intercepts WordPress template_include filter and loads custom templates for job, job_company, and job_location post types (single and archive views).

Parameters
$template : string

Default template path from WordPress.

Tags
since
1.0.0
Return values
string

Template path to use (plugin template or default).

jpkcom_acf_jobs_get_template_part()

Load partial templates with full override support

jpkcom_acf_jobs_get_template_part(string $slug[, string $name = '' ]) : void

Similar to WordPress get_template_part() but uses the plugin's template hierarchy system. Useful for loading reusable template partials.

Example usage: jpkcom_acf_jobs_get_template_part('partials/job/company'); jpkcom_acf_jobs_get_template_part('partials/job/company', 'detailed');

Parameters
$slug : string

Template slug (e.g., 'partials/job/company').

$name : string = ''

Optional. Template name/variation (e.g., 'alternative'). Default empty.

Tags
since
1.0.0

        
On this page

Search results