Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created December 11, 2017 19:56
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/b3b016a05f107daccc6470d4678cf7b2 to your computer and use it in GitHub Desktop.
Save tripflex/b3b016a05f107daccc6470d4678cf7b2 to your computer and use it in GitHub Desktop.
Chosen support for standard WP Job Manager Dropdown Fields
<?php
// ^ there should ONLY be one of these at the top of child theme's functions.php file or use the Code Snippets plugin
// THIS IS JUST ANOTHER EXAMPLE USING THE CODE BELOW TO ONLY LOAD ON THE SUBMIT/EDIT LISTING PAGE IF YOU DONT KNOW
// HOW TO ADD YOUR OWN CUSTOM JAVASCRIPT
// THIS EXAMPLE IS FOR A FIELD WITH THE META KEY OF "candidate_current_title" ... duplicate that line below to add support
// for additional fields
add_action( 'submit_job_form_start', 'my_custom_jquery_init_chosen_on_selects' );
function my_custom_jquery_init_chosen_on_selects(){
echo "<script>
jQuery( function($){
$( '#candidate_current_title' ).chosen();
});
</script>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment