Guest User

Untitled

a guest
Jan 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. function starter_scripts() {
  2. wp_enqueue_style( 'starter-style', get_stylesheet_uri() );
  3.  
  4. wp_enqueue_script( 'jquery', '', '', '', true );
  5.  
  6. wp_enqueue_script( 'includes', get_template_directory_uri() . '/js/min/includes.min.js', '', '', true );
  7. }
  8. add_action( 'wp_enqueue_scripts', 'starter_scripts' );
  9.  
  10. function starter_scripts() {
  11. wp_deregister_script( 'jquery' );
  12. wp_register_script( 'jquery', includes_url( '/js/jquery/jquery.js' ), false, NULL, true );
  13. wp_enqueue_script( 'jquery' );
  14.  
  15. wp_enqueue_style( 'starter-style', get_stylesheet_uri() );
  16. wp_enqueue_script( 'includes', get_template_directory_uri() . '/js/min/includes.min.js', '', '', true );
  17. }
  18. add_action( 'wp_enqueue_scripts', 'starter_scripts' );
  19.  
  20. /**
  21. * Move jQuery to the footer.
  22. */
  23. function wpse_173601_enqueue_scripts() {
  24. wp_scripts()->add_data( 'jquery', 'group', 1 );
  25. wp_scripts()->add_data( 'jquery-core', 'group', 1 );
  26. wp_scripts()->add_data( 'jquery-migrate', 'group', 1 );
  27. }
  28. add_action( 'wp_enqueue_scripts', 'wpse_173601_enqueue_scripts' );
  29.  
  30. add_action( 'wp_default_scripts', 'move_jquery_into_footer' );
  31.  
  32. function move_jquery_into_footer( $wp_scripts ) {
  33.  
  34. if( is_admin() ) {
  35. return;
  36. }
  37.  
  38. $wp_scripts->add_data( 'jquery', 'group', 1 );
  39. $wp_scripts->add_data( 'jquery-core', 'group', 1 );
  40. $wp_scripts->add_data( 'jquery-migrate', 'group', 1 );
  41. }
  42.  
  43. function starter_scripts() {
  44. wp_enqueue_style( 'starter-style', get_stylesheet_uri() );
  45. wp_enqueue_script('jquery');
  46. wp_enqueue_script( 'includes', get_template_directory_uri() . '/js/min/includes.min.js', array( 'jquery' ) );
  47. }
  48. add_action( 'wp_enqueue_scripts', 'starter_scripts' );
  49.  
  50. remove_action('wp_head', 'wp_enqueue_scripts', 1);
  51. add_action('wp_footer', 'wp_enqueue_scripts', 5);
Add Comment
Please, Sign In to add comment