I want to load my javascript and exclude 1 page, so I tried the following without success:
function mypage_scripts()
{
if ( !is_admin() )
{
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js', true, '1.6.2', false);
wp_enqueue_script('jquery');
/* My Script */
if ( !is_page('contact') )
{
wp_enqueue_script('myscript', get_bloginfo('template_url') . '/js/myscript.js', array('jquery'), '1.1', false);
}
}
}
add_action( 'wp_print_scripts', 'mypage_scripts');
The result is that the script loads on every page except on Admin (as expected) but can't manage to not load on "Contact" page.
Any ideas?
Of course I can list all the pages I want to load it, but as the site is going to have more pages in the future I don't want to change the functions.php file everytime a new one is created.
Thanks.
header.php
? Is it essential to have it infunctions.php
?is_admin
check, not when using thewp_print_scripts
action(that particular action, if i'm not mistaken, only runs on non-admin pages).