Question

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');
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top