soft reject function wp_enqueue_script

Hi, i have soft reject.
i don’t understand with this trouble.

reviewers say :
There is no need to use the function wp_enqueue_script just to insert jQuery, since jQuery can be called for those scripts which need it passing the argument array(‘jquery’).

my code :
//Load js
wp_register_script( ‘theme-name-jquery-js’, get_stylesheet_directory_uri() . ‘/lib/js/theme-name-jquery-1.9.1.min.js’, null, ‘1.9.1’ , false );
wp_register_script( ‘theme-name-owl-carousel-js’, get_stylesheet_directory_uri() . ‘/lib/js/theme-name-owl.carousel.js’, null, ‘2.0.0’ , true );
wp_register_script( ‘theme-name-wow-js’, get_stylesheet_directory_uri() . ‘/lib/js/theme-name-wow.min.js’, null, ‘1.1.2’ , true );
wp_register_script( ‘theme-name-SmoothScroll-js’, get_stylesheet_directory_uri() . ‘/lib/js/theme-name-SmoothScroll.js’, null, ‘1.2.1’ , true );
wp_register_script( ‘theme-name-lightbox-js’, get_stylesheet_directory_uri() . ‘/lib/js/theme-name-lightbox.js’, null, ‘2.8.1’ , true );
wp_register_script( ‘theme-name-fitvids-js’, get_stylesheet_directory_uri() . ‘/lib/js/theme-name-jquery.fitvids.js’, null, ‘1.1.0’ , true );

    if( is_rtl() ){
    wp_register_script('theme-name-rtl-js', get_stylesheet_directory_uri() . '/lib/js/theme-name-theme-name-rtl.js', null, theme-name_VERSION, true);
    }else{
    wp_register_script( 'theme-name-theme-name-js', get_stylesheet_directory_uri() . '/lib/js/theme-name-theme-name.js', null, '1.0.0' ,  true );
    }
    wp_register_script( 'theme-name-bootstrap-js', get_stylesheet_directory_uri() . '/lib/js/theme-name-bootstrap.min.js', null, '3.3.5' ,  true );        
 	
  wp_enqueue_script('jquery');
  wp_enqueue_script('theme-name-jquery-js');
  wp_enqueue_script('theme-name-owl-carousel-js');
  wp_enqueue_script('theme-name-wow-js');
  wp_enqueue_script('theme-name-SmoothScroll-js');
  wp_enqueue_script('theme-name-lightbox-js');
  wp_enqueue_script('theme-name-fitvids-js');
  wp_enqueue_script('theme-name-rtl-js');
  wp_enqueue_script('theme-name-theme-name-js');
  wp_enqueue_script('theme-name-bootstrap-js');

how resolve this problem ?

Thanks

you should not load your own jquery file, you have to use wordpress included jquery

Can you give an example ? :smile:

wp_enqueue_script('jquery');

i still don’t understand, i have to enter wp_enqueue_script above and still soft reject what’s wrong ?
Thanks for your respond

Example http://pastebin.com/RW63Ugde

3 Likes

Thanks phpface

Not use “wp_register_script” use directly “wp_enqueue_script”

 Example : wp_enqueue_script( 'theme-name-theme-name-js', plugins_url( '/assets/js/theme-name-theme-name.js', __FILE__ ), 'jquery','',true );
2 Likes

Thanks egprojets :smile: