Created
July 19, 2017 14:53
-
-
Save wpmark/96b3282cc5434be59f9c442754bfe66d to your computer and use it in GitHub Desktop.
Edit Salary Field in WP Broadbean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Edits the salary currency field in WP Broadbean by first removing it and | |
* then re-adding it back in with an additional currency for USD in the select. | |
* | |
* @param arrray $fields The current array of fields. | |
* @return array The modified array if fields. | |
*/ | |
function wpmark_edit_salary_currency_field( $fields ) { | |
// remove the salary currency field by unsetting from the array. | |
unset( $fields['salary_currency'] ); | |
// add a new field for salary dropdown with the same meta key and bb field. | |
$fields['salary_currency'] = array( | |
'name' => __( 'Salary Currency', 'wpbroadbean' ), | |
'id' => '_wpbb_job_salary_currency', | |
'bb_field' => 'salary_currency', | |
'type' => 'select', | |
'options' => array( | |
'zero' => 'Select', | |
'GBP' => 'GBP', | |
'EUR' => 'Euro', | |
'USD' => 'USD', | |
), | |
'cols' => 6, | |
'show_on_frontend' => false | |
); | |
// return the modified fields. | |
return $fields; | |
} | |
add_filter( 'wpbb_job_fields', 'wpmark_edit_salary_currency_field', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment