Fixed examples and move scripts to footer

This commit is contained in:
Ruben Garcia 2017-05-05 20:57:43 +02:00
parent 9967570898
commit 95f31838d8
2 changed files with 6 additions and 6 deletions

View File

@ -179,8 +179,8 @@ if( ! class_exists( 'CMB2_Field_Ajax_Search' ) ) {
*/
public function setup_admin_scripts() {
wp_register_script( 'jquery-autocomplete', plugins_url( 'js/jquery.autocomplete.min.js', __FILE__ ), array( 'jquery' ), self::VERSION );
wp_register_script( 'cmb-ajax-search', plugins_url( 'js/ajax-search.js', __FILE__ ), array( 'jquery', 'jquery-autocomplete', 'jquery-ui-sortable' ), self::VERSION );
wp_register_script( 'jquery-autocomplete', plugins_url( 'js/jquery.autocomplete.min.js', __FILE__ ), array( 'jquery' ), self::VERSION, true );
wp_register_script( 'cmb-ajax-search', plugins_url( 'js/ajax-search.js', __FILE__ ), array( 'jquery', 'jquery-autocomplete', 'jquery-ui-sortable' ), self::VERSION, true );
wp_localize_script( 'cmb-ajax-search', 'cmb_ajax_search', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),

View File

@ -75,7 +75,7 @@ function cmb2_ajax_search_metabox() {
'name' => __( 'Attached user', 'cmb2' ),
'desc' => __( 'Field description (optional)', 'cmb2' ),
'id' => $prefix . 'user',
'type' => 'post_ajax_search',
'type' => 'user_ajax_search',
'query_args' => array(
'role' => array( 'Subscriber' ),
'search_columns' => array( 'user_login', 'user_email' )
@ -87,7 +87,7 @@ function cmb2_ajax_search_metabox() {
'name' => __( 'Multiple users', 'cmb2' ),
'desc' => __( 'Field description (optional)', 'cmb2' ),
'id' => $prefix . 'users',
'type' => 'post_ajax_search',
'type' => 'user_ajax_search',
'multiple' => true,
'limit' => 5,
'query_args' => array(
@ -100,7 +100,7 @@ function cmb2_ajax_search_metabox() {
'name' => __( 'Attached term', 'cmb2' ),
'desc' => __( 'Field description (optional)', 'cmb2' ),
'id' => $prefix . 'term',
'type' => 'post_ajax_search',
'type' => 'term_ajax_search',
'query_args' => array(
'taxonomy' => 'category',
'childless' => true
@ -112,7 +112,7 @@ function cmb2_ajax_search_metabox() {
'name' => __( 'Multiple terms', 'cmb2' ),
'desc' => __( 'Field description (optional)', 'cmb2' ),
'id' => $prefix . 'terms',
'type' => 'post_ajax_search',
'type' => 'term_ajax_search',
'multiple' => true,
'limit' => -1,
'query_args' => array(