Skip to content

Instantly share code, notes, and snippets.

View matadorjobs's full-sized avatar

Matador Jobs matadorjobs

View GitHub Profile
@matadorjobs
matadorjobs / matador_docs_taxonomy_terms_term_label.php
Last active August 11, 2023 14:39
Display count of jobs per term in a Matador taxonomy term list
<?php //omit opening tag
add_filter( 'matador_taxonomy_terms_term_label', 'matador_docs_matador_taxonomy_terms_term_label', 10, 2 );
/**
* Matador Docs Example: Add Term Count to Taxonomy Term Label
*
* In this example, display count of jobs per term in a Matador taxonomy term list.
*
* @since 2023-05-01
*
@matadorjobs
matadorjobs / require_resume_submission_at_processing_level.php
Created May 2, 2023 17:54
Matador Docs Example: Require Resume Submission at Processing Level
<?php // omit opening PHP tag
add_filter( 'matador_application_data_raw', 'matador_docs_require_resume_submission_at_processing_level', 20 );
/**
* Matador Docs Example: Require Resume Submission at Processing Level
*
* In the event spam bots have found a way to bypass your resume requirement, this is an added layer of validation to
* stop the spam from sneaking through. This will have a poor User Interface in the event you use this on forms where
* a resume is optional and this is a site-wide "hammer" solution, so all applications must require resume if you intend
* to use this. Further, this will break the "Matador Jobs Pro - Contact Form Extension" if you use it.
*
@matadorjobs
matadorjobs / matador_docs_theme_button_classes.php
Created May 2, 2023 01:26
Assuming our theme has previously defined classes for buttons of 'button', 'button-secondary', and 'button-alternate', give those CSS classes to Matador Buttons so to adopt theme CSS conventions.
<?php //omit opening tag
add_filter( 'matador_template_button_classes', 'matador_docs_theme_button_classes', 10, 2 );
/**
* Matador Docs Example: Theme Button Classes
*
* Assuming our theme has previously defined classes for buttons of 'button', 'button-secondary', and 'button-alternate', give those CSS classes to Matador Buttons so to adopt theme CSS conventions.
*
* @since 2023-05-01
*
// replace the standard values of "Submitted" or "new Lead"
add_filter( 'matador_data_source_status', function(){
return 'Candidate';
} );
/**
* Matador Data Status Description
*
@matadorjobs
matadorjobs / matador_data_source_description_1.php
Last active October 6, 2022 20:44
matador_data_source_description hook usage examples
<?php
namespace matador_docs;
add_filter( 'matador_data_source_description', 'matador_docs\matador_data_source_description_1', 10, 4 );
/**
* Matador Data Source Description Hook Usage Example 1
*
* Change from "{Site Name} Website" to "Corporate Site".
*
* @see https://docs.matadorjobs.com/articles/matador_data_source_description/
@matadorjobs
matadorjobs / example_matador_template_the_job_meta.php
Last active May 13, 2022 07:34
Modify Job Meta Fields Before Presentation
// If using matador_the_job_meta(), matador_get_the_job_meta(), or the [matador_job_field name="field"] shortcode,
// filter the output on its way out to your template using one of the following filters.
/**
* Dynamic Filter: Matador Template The Job Meta
*
* @since 3.4.0
*
* @param string $meta Meta value.
* @param int $id ID of job.
@matadorjobs
matadorjobs / example_matador_docs_matador_bullhorn_import_fields.php
Last active May 11, 2022 05:49
Matador Docs Example: Import Additional (custom) Fields to Your Job
<?php
/**
* Example: Import Additional Job Fields from Bullhorn
*
* Example below imports Bullhorn field named 'customText4', calls it 'salary_range', declares it a 'string', and saves it as
* Job Meta for use in the front-end of the website, presumably to replace the 'salary' with a more descriptive range stat.
*
* @since 2019-07-19
* @updated 2022-05-10
*
@matadorjobs
matadorjobs / snippet_change_state_to_US_states_dropdown.php
Created February 22, 2021 19:06
Change the state/province application form field to a drop-down of US states and territories.
<?php // omit opening PHP tag
add_filter( 'matador_application_fields_structure', 'mdocs_change_state_field_to_US_states_dropdown', 50, 1 );
/**
* Matador Change "State" to US States Dropdown
*
* Change the state/province application form field to a drop-down (<select>) of US states and territories.
*
* @since 2021-02-22
*
* @param array $fields Array of Form Fields
@matadorjobs
matadorjobs / matador_jobs_add_logo_to_job_structured_data.php
Created March 29, 2019 17:05
Matador Jobs add a company/site logo to Job JSON+LD
<?php
/**
* Add Logo to Job Structured Data (JSON+LD)
*
* @see https://matadorjobs.com/support/documentation/add-a-logo-to-google-for-jobs-listings/
*
* @param array $ld the Job Structured Data before save.
* @return array $ld the modified Job Structured Data for saving.
*/
function mj_add_logo_to_job_jsonld( $ld ) {
@matadorjobs
matadorjobs / matador_template_button_classes.php
Created July 13, 2020 17:01
Apply template class names to Matador Buttons
<?php // omit opening PHP tag
add_filter( 'matador_template_button_classes', 'mdocs_matador_template_button_classes', 10, 2 );
/**
* Matador Template Button Classes Example Filter
*
* @since 2020-07-12
*
* @param string $classes Space-separated string of classes for a button
* @param string $context Button context, for filtering purposes, either 'primary', 'secondary', or 'tertiary'
*