为什么jquery不使用wordpress入队?

我只是改变了我在这个方法的主题中排队jquery的方式:

function my_init() { if (!is_admin()) { // comment out the next two lines to load the local copy of jQuery wp_deregister_script('jquery'); wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', false, '1.7.2'); wp_enqueue_script('jquery'); } } add_action('wp_enqueue_scripts', 'my_init'); 

对此:

 function my_scripts_method() { wp_enqueue_script('jquery'); } add_action('wp_enqueue_scripts', 'my_scripts_method'); function my_admin_scripts_method() { wp_enqueue_script('jquery'); } add_action('admin_enqueue_scripts', 'my_admin_scripts_method'); 

旧版本使用1.7.2,wordpress’内置版本为1.7.1。 我试过将1.7.1的地址复制并粘贴到第一个版本中,它就是一样的。 该链接存在于1.7.1版本的源代码中,但jquery不起作用。 什么可能导致这个?

url:www.brainbuzzmedia.com/themes/vertex/

我不知道究竟是什么问题,但试试这个。

 function wptuts_scripts_with_jquery() { // Register the script like this for a plugin: wp_register_script( 'custom-script', plugins_url( '/js/custom-script.js', __FILE__ ), array( 'jquery' ) ); // or // Register the script like this for a theme: wp_register_script( 'custom-script', get_template_directory_uri() . '/js/custom-script.js', array( 'jquery' ) ); // For either a plugin or a theme, you can then enqueue the script: wp_enqueue_script( 'custom-script' ); } add_action( 'wp_enqueue_scripts', 'wptuts_scripts_with_jquery' ); 

欲了解更多信息 ……

 function my_scripts_method() { if (!is_admin()) { wp_enqueue_script('jquery'); } } add_action('wp_enqueue_scripts', 'my_scripts_method'); function my_admin_scripts_method() { // you don't need to load jquery here, because its automatically loaded in the adminby default } add_action('admin_enqueue_scripts', 'my_admin_scripts_method');