[wp-hackers] [WPSoC][Mid-term update] codeWord progress so far...

Otto otto at ottodestruct.com
Fri Jul 11 15:17:09 GMT 2008


Gotta say that I'm not a fan of the way you're inserting the scripts...

Problem 1: A stylesheet link in the footer? Does not validate. Move it
to the header section.
Problem 2: Why are you not using wp_enqueue_script? Looks like you
made an abortive attempt at that? Try this sort of thing:

function codeWord_scripts() {
        wp_enqueue_script('jquery-form'); // already defined by wordpress
        wp_enqueue_script('jquery-bgiframe',
'/wp-content/plugins/codeword/autocomplete/jquery.bgiframe.min.js',
array('jquery'), '2.1.1' );
        wp_enqueue_script('jquery-autocomplete',
'/wp-content/plugins/codeword/autocomplete/jquery.autocomplete.js',
array('jquery'), '1.0.2' );
        wp_enqueue_script('localdata',
'/wp-content/plugins/codeword/autocomplete/localdata',
array('jquery'), '1.0' );
        wp_enqueue_styles('jquery-autocomplete',
'/wp-content/plugins/codeword/autocomplete/jquery.autocomplete.css',
array(), '1.0.2' );
}
add_action('admin_menu', 'codeWord_scripts');


That will work for both the styles and the scripts. Note that the
enqueue style stuff is new to WordPress 2.6, I think.


More information about the wp-hackers mailing list