I'm working on to writing a Wordpress Plugin based on: http://wppb.io/
My issue is: I'm working on Public view and try to use Ajax to connect with backend.I'm use: public/js/ xxx-public.js to place all ajax function handle and Define some hooks:
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/xxx-public.js', array( 'jquery' ), $this->version, false );
wp_register_script( 'district_handle', plugin_dir_url( __FILE__ ) . 'js/xxx-public.js', array( 'jquery' ), $this->version, false );
wp_enqueue_script( 'district_handle');
wp_register_script( 'ret_cus_handle', plugin_dir_url( __FILE__ ) . 'js/xxx-public.js' , array( 'jquery' ), $this->version, false);
wp_enqueue_script( 'ret_cus_handle');
wp_register_script( 'order_ret_cus_handle', plugin_dir_url( __FILE__ ) . 'js/xxx-public.js', array( 'jquery' ), $this->version, false );
wp_enqueue_script( 'order_ret_cus_handle');
It works.
But problem is: the website will generate 4 xxx-public.js in header. I only want one.
I'm just a newbie with WP plugin. I hope to get your solution. Thank you in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire