API Documentation
Table of Contents
Namespaces
Constants
- JPKCOM_ACFJOBS_BASENAME = \plugin_basename(__FILE__)
- JPKCOM_ACFJOBS_PLUGIN_PATH = \plugin_dir_path(__FILE__)
- JPKCOM_ACFJOBS_PLUGIN_URL = \plugin_dir_url(__FILE__)
- JPKCOM_ACFJOBS_VERSION = '1.3.2'
Functions
- jpkcom_acf_jobs_disable_archive_field() : void
- Render disable archive checkbox field
- jpkcom_acf_jobs_redirect_url_field() : void
- Render archive redirect URL field
- jpkcom_acf_jobs_options_page() : void
- Render Options admin page
- jpkcom_acf_jobs_breadcrumb() : void
- Output Bootstrap 5 breadcrumb navigation
- jpkcom_render_acf_fields() : void
- Renders all ACF fields of a post with Bootstrap 5 markup and smart icons
- acf_get_field_label() : string
- Get ACF field label by field key or field name
- jpkcom_get_acf_field_label() : string
- Get ACF field label with enhanced search capabilities
- jpkcom_human_readable_relative_date() : string
- Convert timestamp to human-readable relative date string
- jpkcom_acf_jobs_media_size() : void
- Register custom image sizes for job posts
- jpkcom_acf_jobs_image_sizes_to_selector() : array<string|int, string>
- Add custom image sizes to media library size selector
- jpkcom_acf_jobs_pagination() : void
- Output Bootstrap 5 pagination navigation
- jpkcom_acf_jobs_get_schema_job_posting() : string
- Generate Schema.org JobPosting JSON-LD for a single job post
- jpkcom_acf_jobs_locate_template() : string|false
- 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
- jpkcom_acfjobs_textdomain() : void
- Load plugin text domain for translations
- jpkcom_acfjobs_locate_file() : string|null
- Locate file with override support
Constants
JPKCOM_ACFJOBS_BASENAME
public
mixed
JPKCOM_ACFJOBS_BASENAME
= \plugin_basename(__FILE__)
JPKCOM_ACFJOBS_PLUGIN_PATH
public
mixed
JPKCOM_ACFJOBS_PLUGIN_PATH
= \plugin_dir_path(__FILE__)
JPKCOM_ACFJOBS_PLUGIN_URL
public
mixed
JPKCOM_ACFJOBS_PLUGIN_URL
= \plugin_dir_url(__FILE__)
JPKCOM_ACFJOBS_VERSION
public
mixed
JPKCOM_ACFJOBS_VERSION
= '1.3.2'
Functions
jpkcom_acf_jobs_disable_archive_field()
Render disable archive checkbox field
jpkcom_acf_jobs_disable_archive_field() : void
Tags
jpkcom_acf_jobs_redirect_url_field()
Render archive redirect URL field
jpkcom_acf_jobs_redirect_url_field() : void
Tags
jpkcom_acf_jobs_options_page()
Render Options admin page
jpkcom_acf_jobs_options_page() : void
Tags
jpkcom_acf_jobs_breadcrumb()
Output Bootstrap 5 breadcrumb navigation
jpkcom_acf_jobs_breadcrumb() : void
Generates breadcrumb navigation for:
- Single job posts (Home > Jobs > Job Title)
- Job archive (Home > Jobs)
- Other pages (Home > Page Title)
Includes proper ARIA labels and semantic HTML5 markup.
Tags
Return values
void —Outputs HTML directly.
jpkcom_render_acf_fields()
Renders all ACF fields of a post with Bootstrap 5 markup and smart icons
jpkcom_render_acf_fields([string $post_type = '' ]) : void
Automatically detects field types and renders them with appropriate styling:
- Images: Responsive with rounded corners
- WYSIWYG/Textarea: Light background container
- Relationships/Post Objects: Linked post titles
- True/False: Badge indicators
- Repeater: Responsive tables
- Groups: Nested definition lists
Parameters
- $post_type : string = ''
-
Optional. Post type for field group query. Default empty (uses current post type).
Tags
acf_get_field_label()
Get ACF field label by field key or field name
acf_get_field_label(string $field_key_or_name) : string
Attempts to retrieve the field label from ACF. If not found, returns a formatted fallback based on the field name/key.
Parameters
- $field_key_or_name : string
-
Field key (e.g., 'field_abc123') or field name (e.g., 'job_title').
Tags
Return values
string —Field label or formatted fallback string.
jpkcom_get_acf_field_label()
Get ACF field label with enhanced search capabilities
jpkcom_get_acf_field_label(string $field_name_or_key[, string $post_type = '' ]) : string
Searches for field labels in this order:
- Direct field key lookup (if starts with 'field_')
- Search through field groups by post type
- Search through sub_fields (repeater/group fields)
- Fallback to formatted field name
Parameters
- $field_name_or_key : string
-
Field name (e.g., 'job_title') or field key (e.g., 'field_abc123').
- $post_type : string = ''
-
Optional. Post type for context-specific field group search. Default empty.
Tags
Return values
string —Field label or formatted fallback string.
jpkcom_human_readable_relative_date()
Convert timestamp to human-readable relative date string
jpkcom_human_readable_relative_date(int $timestamp) : string
Converts Unix timestamps into relative date strings like:
- "Published today"
- "Published yesterday"
- "Published 3 days ago"
- "Published 2 weeks ago"
- "Published 5 months ago"
- "Published 2 years ago"
All strings are translatable via the 'jpkcom-acf-jobs' text domain.
Parameters
- $timestamp : int
-
Unix timestamp to convert.
Tags
Return values
string —Translated relative date string.
jpkcom_acf_jobs_media_size()
Register custom image sizes for job posts
jpkcom_acf_jobs_media_size() : void
Registers three image sizes:
- jpkcom-acf-job-16x9: 576x324px (16:9, hard crop)
- jpkcom-acf-job-logo: 512x512px (square, hard crop)
- jpkcom-acf-job-header: 992x558px (16:9, hard crop)
Tags
jpkcom_acf_jobs_image_sizes_to_selector()
Add custom image sizes to media library size selector
jpkcom_acf_jobs_image_sizes_to_selector(array<string|int, string> $sizes) : array<string|int, string>
Makes custom image sizes available in the WordPress media library dropdown when inserting images into posts.
Parameters
- $sizes : array<string|int, string>
-
Existing image size options.
Tags
Return values
array<string|int, string> —Modified array with custom sizes added.
jpkcom_acf_jobs_pagination()
Output Bootstrap 5 pagination navigation
jpkcom_acf_jobs_pagination([string|int $pages = '' ][, int $range = 2 ]) : void
Generates numbered pagination with first/last and prev/next controls. Includes proper ARIA labels and accessible markup.
Features:
- First/Last page links (« »)
- Previous/Next page links (‹ ›)
- Numbered page links with range control
- Active page indicator
- Disabled state for unavailable actions
Parameters
- $pages : string|int = ''
-
Optional. Total number of pages. Default empty (auto-detect from query).
- $range : int = 2
-
Optional. Number of page links to show on either side of current page. Default 2.
Tags
Return values
void —Outputs HTML directly.
jpkcom_acf_jobs_get_schema_job_posting()
Generate Schema.org JobPosting JSON-LD for a single job post
jpkcom_acf_jobs_get_schema_job_posting([int|null $post_id = null ]) : string
Creates a complete JobPosting schema including:
- Basic job information (title, description, dates)
- Employment type (FULL_TIME, PART_TIME, etc.)
- Hiring organization details and logo
- Job location(s) with postal addresses
- Work type (on-site, remote/TELECOMMUTE)
- Base salary information
- Application contact/URL
- Job benefits from taxonomy terms
The schema can be filtered using the 'jpkcom_acf_jobs_schema_job_posting' hook.
Parameters
- $post_id : int|null = null
-
Optional. Post ID of the job post. Default null (uses current post).
Tags
Return values
string —JSON-LD formatted string ready for output in <script> tag, or empty string on failure.
jpkcom_acf_jobs_locate_template()
jpkcom_acf_jobs_locate_template(string $template_name) : string|false
Parameters
- $template_name : string
Return values
string|falsejpkcom_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:
- Child Theme: /wp-content/themes/your-child-theme/jpkcom-acf-jobs/
- Parent Theme: /wp-content/themes/your-theme/jpkcom-acf-jobs/
- MU plugin override: /wp-content/mu-plugins/jpkcom-acf-jobs-overrides/templates/
- 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
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
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
jpkcom_acfjobs_textdomain()
Load plugin text domain for translations
jpkcom_acfjobs_textdomain() : void
Loads translation files from the /languages directory.
Tags
jpkcom_acfjobs_locate_file()
Locate file with override support
jpkcom_acfjobs_locate_file(string $filename) : string|null
Searches for a file in multiple locations with priority:
- Child theme
- Parent theme
- MU plugin overrides
- Plugin includes directory
Parameters
- $filename : string
-
The filename to locate (without path).
Tags
Return values
string|null —Full path to the file if found, null otherwise.