Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created September 14, 2020 18: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/8ce05922a4e2ae8f5a5b40e1d853706e to your computer and use it in GitHub Desktop.
Save tripflex/8ce05922a4e2ae8f5a5b40e1d853706e to your computer and use it in GitHub Desktop.
Initialize Select2 on standard dropdown fields when using WP Job Manager Field Editor
<?php
// ^ there should ONLY be one of these at the top of child theme's functions.php file or use the Code Snippets plugin
add_action( 'submit_job_form_start', 'my_custom_jquery_init_select2_on_selects' );
function my_custom_jquery_init_select2_on_selects(){
echo "<script>jQuery( function($){ $( '.jmfe-select-field' ).select2(); });</script>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment