Fixed examples and move scripts to footer
This commit is contained in:
parent
9967570898
commit
95f31838d8
|
@ -179,8 +179,8 @@ if( ! class_exists( 'CMB2_Field_Ajax_Search' ) ) {
|
||||||
*/
|
*/
|
||||||
public function setup_admin_scripts() {
|
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( '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 );
|
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(
|
wp_localize_script( 'cmb-ajax-search', 'cmb_ajax_search', array(
|
||||||
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
||||||
|
|
|
@ -75,7 +75,7 @@ function cmb2_ajax_search_metabox() {
|
||||||
'name' => __( 'Attached user', 'cmb2' ),
|
'name' => __( 'Attached user', 'cmb2' ),
|
||||||
'desc' => __( 'Field description (optional)', 'cmb2' ),
|
'desc' => __( 'Field description (optional)', 'cmb2' ),
|
||||||
'id' => $prefix . 'user',
|
'id' => $prefix . 'user',
|
||||||
'type' => 'post_ajax_search',
|
'type' => 'user_ajax_search',
|
||||||
'query_args' => array(
|
'query_args' => array(
|
||||||
'role' => array( 'Subscriber' ),
|
'role' => array( 'Subscriber' ),
|
||||||
'search_columns' => array( 'user_login', 'user_email' )
|
'search_columns' => array( 'user_login', 'user_email' )
|
||||||
|
@ -87,7 +87,7 @@ function cmb2_ajax_search_metabox() {
|
||||||
'name' => __( 'Multiple users', 'cmb2' ),
|
'name' => __( 'Multiple users', 'cmb2' ),
|
||||||
'desc' => __( 'Field description (optional)', 'cmb2' ),
|
'desc' => __( 'Field description (optional)', 'cmb2' ),
|
||||||
'id' => $prefix . 'users',
|
'id' => $prefix . 'users',
|
||||||
'type' => 'post_ajax_search',
|
'type' => 'user_ajax_search',
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'limit' => 5,
|
'limit' => 5,
|
||||||
'query_args' => array(
|
'query_args' => array(
|
||||||
|
@ -100,7 +100,7 @@ function cmb2_ajax_search_metabox() {
|
||||||
'name' => __( 'Attached term', 'cmb2' ),
|
'name' => __( 'Attached term', 'cmb2' ),
|
||||||
'desc' => __( 'Field description (optional)', 'cmb2' ),
|
'desc' => __( 'Field description (optional)', 'cmb2' ),
|
||||||
'id' => $prefix . 'term',
|
'id' => $prefix . 'term',
|
||||||
'type' => 'post_ajax_search',
|
'type' => 'term_ajax_search',
|
||||||
'query_args' => array(
|
'query_args' => array(
|
||||||
'taxonomy' => 'category',
|
'taxonomy' => 'category',
|
||||||
'childless' => true
|
'childless' => true
|
||||||
|
@ -112,7 +112,7 @@ function cmb2_ajax_search_metabox() {
|
||||||
'name' => __( 'Multiple terms', 'cmb2' ),
|
'name' => __( 'Multiple terms', 'cmb2' ),
|
||||||
'desc' => __( 'Field description (optional)', 'cmb2' ),
|
'desc' => __( 'Field description (optional)', 'cmb2' ),
|
||||||
'id' => $prefix . 'terms',
|
'id' => $prefix . 'terms',
|
||||||
'type' => 'post_ajax_search',
|
'type' => 'term_ajax_search',
|
||||||
'multiple' => true,
|
'multiple' => true,
|
||||||
'limit' => -1,
|
'limit' => -1,
|
||||||
'query_args' => array(
|
'query_args' => array(
|
||||||
|
|
Loading…
Reference in New Issue