Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to call multiple JQuery scripts using wp_enqueue_script. The call to JQuery works perfectly but the second call to cufon doesn't. I'm not a php or javascript expert - could anyone lend a hand, is there a best practice method for this?

function my_init_method() {
    if (!is_admin()) {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js');
        wp_enqueue_script( 'jquery' );
    }
}    

add_action('init', 'my_init_method');

function my_init_method2() {
    if (!is_admin()) {
        wp_deregister_script( 'cufon' );
        wp_register_script( 'cufon', 'http://mydomain.com/wp-content/themes/simplefolio/js/cufon-yui.js');
        wp_enqueue_script( 'cufon' );
    }
}    

add_action('init', 'my_init_method2');
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I'm not good at this, but it could be because Cufon is not included in Wordpress?

So, you are deregistrating a script that is not included..

http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_scripts_included_with_WordPress

share|improve this answer
    
Hit the nail on the head! –  toomanyairmiles Mar 12 '11 at 17:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.