linccce

Wordpress dequeue

Jun 8th, 2015
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.19 KB | None | 0 0
  1. cherry framework one CherryFrameowrk/includes/theme-scripts.php:
  2. function cherry_scripts() {
  3.     if (!is_admin()) {
  4.         // CherryFramework Scripts
  5.         wp_deregister_script('jquery');
  6.         wp_register_script('jquery', PARENT_URL.'/js/jquery-1.7.2.min.js', false, '1.7.2');
  7.         wp_enqueue_script('jquery');
  8.         wp_register_script('migrate', PARENT_URL.'/js/jquery-migrate-1.2.1.min.js', array('jquery'), '1.2.1');
  9.         wp_enqueue_script('migrate');
  10.  
  11.         wp_register_script('modernizr', PARENT_URL.'/js/modernizr.js', array('jquery'), '2.0.6');
  12.         wp_register_script('jflickrfeed', PARENT_URL.'/js/jflickrfeed.js', array('jquery'), '1.0');
  13.         wp_register_script('superfish', PARENT_URL.'/js/superfish.js', array('jquery'), '1.5.3', true);
  14.         wp_register_script('mobilemenu', PARENT_URL.'/js/jquery.mobilemenu.js', array('jquery'), '1.0', true);
  15.         wp_register_script('easing', PARENT_URL.'/js/jquery.easing.1.3.js', array('jquery'), '1.3', true);
  16.         wp_register_script('magnific-popup', PARENT_URL.'/js/jquery.magnific-popup.min.js', array('jquery'), '0.9.3', true);
  17.         wp_register_script('flexslider', PARENT_URL.'/js/jquery.flexslider.js', array('jquery'), '2.1', true);
  18.         wp_register_script('playlist', PARENT_URL.'/js/jplayer.playlist.min.js', array('jquery'), '2.3.0', true);
  19.         wp_register_script('jplayer', PARENT_URL.'/js/jquery.jplayer.min.js', array('jquery'), '2.6.0', true);
  20.         wp_register_script('tmstickup', PARENT_URL.'/js/tmstickup.js', array('jquery'), '1.0.0', true);
  21.         wp_register_script('device', PARENT_URL.'/js/device.min.js', array('jquery'), '1.0.0', true);
  22.         wp_register_script('custom', PARENT_URL.'/js/custom.js', array('jquery'), '1.0');
  23.  
  24.         wp_enqueue_script('swfobject');
  25.         wp_enqueue_script('modernizr');
  26.         wp_enqueue_script('jflickrfeed');
  27.         wp_enqueue_script('superfish');
  28.         wp_enqueue_script('mobilemenu');
  29.         wp_enqueue_script('easing');
  30.         wp_enqueue_script('magnific-popup');
  31.         wp_enqueue_script('flexslider');
  32.         wp_enqueue_script('playlist');
  33.         wp_enqueue_script('jplayer');
  34.         wp_enqueue_script('tmstickup');
  35.         wp_enqueue_script('device');
  36.         wp_enqueue_script('custom');
  37.  
  38.         wp_register_script('zaccordion', PARENT_URL.'/js/jquery.zaccordion.min.js', array('jquery'), '2.1.0', true);
  39.         wp_enqueue_script('zaccordion');
  40.         wp_register_script('camera', PARENT_URL.'/js/camera.min.js', array('jquery'), '1.3.4', true);
  41.         wp_enqueue_script('camera');
  42.  
  43.         // only Portfolio (2-*, 3-*, 4-Columns), Home and Front Pages
  44.         if ( (is_page_template('page-Portfolio2Cols-filterable.php'))
  45.             || (is_page_template('page-Portfolio3Cols-filterable.php'))
  46.             || (is_page_template('page-Portfolio4Cols-filterable.php'))
  47.             || is_home()
  48.             || is_front_page()) {
  49.             wp_register_script('debouncedresize', PARENT_URL.'/js/jquery.debouncedresize.js', array('jquery'), '1.0', true);
  50.             wp_register_script('ba-resize', PARENT_URL.'/js/jquery.ba-resize.min.js', array('jquery'), '1.1', true);
  51.             wp_register_script('isotope', PARENT_URL.'/js/jquery.isotope.js', array('jquery'), '1.5.25', true);
  52.             wp_enqueue_script('debouncedresize');
  53.             wp_enqueue_script('ba-resize');
  54.             wp_enqueue_script('isotope');
  55.         }
  56.         // only child theme's where overwrite flickr widget
  57.         if ( (CURRENT_THEME!='cherry') && (file_exists(CHILD_DIR. '/includes/widgets/my-flickr-widget.php')) ) {
  58.             wp_register_script('prettyPhoto', PARENT_URL.'/js/jquery.prettyPhoto.js', array('jquery'), '3.1.5');
  59.             wp_enqueue_script('prettyPhoto');
  60.         }
  61.         // Bootstrap Scripts
  62.         wp_register_script('bootstrap', PARENT_URL.'/bootstrap/js/bootstrap.min.js', array('jquery'), '2.3.0');
  63.         wp_enqueue_script('bootstrap');
  64.     }
  65. }
  66. add_action('wp_enqueue_scripts', 'cherry_scripts');
  67.  
  68. //my_child_theme/functions.php
  69. function estlita_scripts() {
  70.         // CherryFramework Scripts
  71.         wp_deregister_script('jquery');
  72.         wp_dequeue_script('jquery');
  73.         wp_register_script('jquery', get_stylesheet_directory_uri().'/js/jquery-1.11.3.min.js', false, '1.11.3');
  74.         wp_enqueue_script('jquery');
  75. }
  76. add_action('wp_enqueue_scripts', 'estlita_scripts');
  77.  
  78. function wpa54064_inspect_scripts() {
  79.     global $wp_scripts;
  80.     foreach( $wp_scripts->queue as $handle ) :
  81.         echo "<br/>$handle";
  82.     endforeach;
  83. }
  84. add_action( 'wp_print_scripts', 'wpa54064_inspect_scripts' );
Advertisement
Add Comment
Please, Sign In to add comment