Skip to content

Instantly share code, notes, and snippets.

@zachharkey
Created February 20, 2013 07:01
Show Gist options
  • Save zachharkey/4993530 to your computer and use it in GitHub Desktop.
Save zachharkey/4993530 to your computer and use it in GitHub Desktop.
Drupal 7 Using Newer Versions of jQuery on certain pages Method 4: Swapping jquery with preprocess page http://drupal.org/node/1058168
<?php
function MYTHEME_preprocess_page(&$variables) {
// exclude backend pages to avoid core js not working anymore
// you could also just use a backend theme to avoid this
if (arg(0) != 'admin' || !(arg(1) == 'add' && arg(2) == 'edit') || arg(0) != 'panels' || arg(0) != 'ctools') {
$scripts = drupal_add_js();
$new_jquery = array(drupal_get_path('theme', 'YOURTHEME') . '/js/jquery-1.7.1.min.js' => $scripts['core']['misc/jquery.js']);
$scripts['core'] = array_merge($new_jquery, $scripts['core']);
unset($scripts['core']['misc/jquery.js']);
$variables['scripts'] = drupal_get_js('header', $scripts);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment