Matador Job’s Recruiter Profiles extension provides several default fields for recruiters’ details. However, we’re aware some of our users may need to display additional fields for their recruiters. This how-to guide will walk you through an example of adding a ‘Hobbies & Interests’ field.
You can add custom meta fields to the recruiter post type with the matador_extension_recruiters_default_meta_fields filter:
/**
* Filters the default meta fields for recruiters.
*
* Allows modification of the default meta fields used for recruiters, such as adding new fields
* or removing existing ones. If you want your custom field to be considered a meta field add it
* using this filter, otherwise see 'matador_extension_recruiters_default_display_fields'
*
* @since 1.0.0
* @param array $fields The current array of default meta fields.
*/
return apply_filters( 'matador_extension_recruiters_default_meta_fields', $fields );
By hooking a function to this filter, we can insert our ‘Hobbies & Interests’ field as follows:
add_filter( 'matador_extension_recruiters_default_meta_fields', 'add_recruiter_hobbies_field_to_defaults' );
function add_recruiter_hobbies_field_to_defaults( $fields ) {
$hobbies_field = [
"type" => "text",
"label" => "Recruiter's Hobbies & Interests",
"id" => "recruiter_hobbies"
];
$fields_with_hobbies = $fields;
$fields_with_hobbies[] = $hobbies_field;
return $fields_with_hobbies;
}
Now when we create a new (or edit an existing) recruiter, we can see a “Recruiter’s Hobbies & Interests” field to fill in. This field can be toggled on/off as a default, and overriden in blocks & shortcodes just like the extensions standard recruiter fields.