Missing dependency in wp_enqueue_script functions
-
When I installed this plugin, I’ve noticed it’s not working, because it loads its libraries before jquery.
Next I’ve checked your plugin php files and noticed in mousewheel-smooth-scroll.php that it doesn’t have dependencies stated in wp_enqueue_script functions.Before correction:
function plugin_scripts_load() { wp_enqueue_script( 'wpmss_jquery_mousewheel', plugins_url( 'js/jquery.mousewheel.min.js' , __FILE__ )); wp_enqueue_script( 'wpmss_jquery_easing', plugins_url( 'js/jquery.easing.1.3.js' , __FILE__ )); $options = array( 'step' => isset( $this->settings['general']['step'] ) && trim( $this->settings['general']['step'] ) != "" ? $this->settings['general']['step'] : 120, 'speed' => isset( $this->settings['general']['speed'] ) && trim( $this->settings['general']['step'] ) != "" ? $this->settings['general']['speed'] : 800, 'ease' => isset( $this->settings['general']['ease'] ) ? $this->settings['general']['ease'] : 'easeOutCubic', 'enableAll' => isset( $this->settings['general']['enable_mac'] ) ? 1 : 0 ); wp_enqueue_script( 'wpmss_simplr_smoothscroll', plugins_url( 'js/jquery.simplr.smoothscroll.js' , __FILE__ )); wp_enqueue_script( 'wpmss_script', plugins_url( 'js/wpmss.php?'.http_build_query($options) , __FILE__ )); }
After correction:
function plugin_scripts_load() { wp_enqueue_script( 'wpmss_jquery_mousewheel', plugins_url( 'js/jquery.mousewheel.min.js' , __FILE__ ), array( 'jquery' )); wp_enqueue_script( 'wpmss_jquery_easing', plugins_url( 'js/jquery.easing.1.3.js' , __FILE__ ), array( 'jquery' )); $options = array( 'step' => isset( $this->settings['general']['step'] ) && trim( $this->settings['general']['step'] ) != "" ? $this->settings['general']['step'] : 120, 'speed' => isset( $this->settings['general']['speed'] ) && trim( $this->settings['general']['step'] ) != "" ? $this->settings['general']['speed'] : 800, 'ease' => isset( $this->settings['general']['ease'] ) ? $this->settings['general']['ease'] : 'easeOutCubic', 'enableAll' => isset( $this->settings['general']['enable_mac'] ) ? 1 : 0 ); wp_enqueue_script( 'wpmss_simplr_smoothscroll', plugins_url( 'js/jquery.simplr.smoothscroll.js' , __FILE__ ), array( 'jquery' )); wp_enqueue_script( 'wpmss_script', plugins_url( 'js/wpmss.php?'.http_build_query($options) , __FILE__ ), array( 'jquery' )); }
There’s array( ‘jquery’ ) argument in end of every wp_enqueue_script line.
Now it’s working fine. Please correct this in next update, so others won’t have any problems.
https://www.ads-software.com/plugins/mousewheel-smooth-scroll/
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Missing dependency in wp_enqueue_script functions’ is closed to new replies.