Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created August 1, 2017 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/e36a71ff24b17b1914a64f04211518af to your computer and use it in GitHub Desktop.
Save tripflex/e36a71ff24b17b1914a64f04211518af to your computer and use it in GitHub Desktop.
WP Job Manager Field Editor add custom Auto Output Locations/Hooks/Actions
<?php
add_filter( 'field_editor_output_options', 'smyles_custom_output_locations', 20, 2 );
/**
* Add Custom Auto Output Locations
*
* This will add custom auto output locations to the modal configuration in auto
* output field configuration. All you would need to do is add the do_action( $key )
* in the template file. The $key value should be the KEY used in the array .. in the example
* below that would be single_resume_middle_meta_area, single_resume_right_meta_area
*
* @param $locations
* @param $field_group
*
* @return mixed
*/
function smyles_custom_output_locations( $locations, $field_group ) {
// We only want to add custom actions when no field group (to automatically setup callback)
// or when resume_fields field_group passed (meaning called for output in dropdown in modal)
if( empty( $field_group ) || $field_group === 'resume_fields' ){
$locations['single_resume_middle_meta_area'] = __( 'Resume Middle Meta Area' );
$locations['single_resume_right_meta_area'] = __( 'Resume Right Meta Area' );
}
// Same as above, but specifically for job or company fields
if ( empty( $field_group ) || $field_group === 'job' || $field_group === 'company' ) {
$locations['job_middle_meta_area'] = __( 'Job Middle Meta Area' );
$locations['job_right_meta_area'] = __( 'Job Right Meta Area' );
}
return $locations;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment