WordPress可以通过手动嵌入式js和样式嵌入来获得挑剔。注入它们的正确方法是add_actions
到init
,print_scripts
和print_sytles
。以下,或者类似的东西添加到您的Functions.php
:
// register scripts
if (! function_exists(register_scripts){
function register_scripts() {
wp_deregister_script('jquery');
wp_register_script('jquery','http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js');
}
}
add_action('init', 'register_scripts');
//print the now registered scripts
if (! function_exists(print_scripts){
function print_scripts() {
wp_enqueue_script('jquery');
}
}
add_action('wp_print_scripts', 'print_scripts');
// do the same for css
if (! function_exists(print_styles){
function print_styles() {
wp_register_style('stylesheet', 'path to css'.stylesheet.css); //bloginfo(url); or something like it to obtain your path
wp_enqueue_style('stylesheet');
}
}
add_action('wp_print_styles', 'print_styles');
它多一点的工作,但确保脚本和样式得到正确插入,并在同一时间的wordpress选择这样做......
如果这是导致你的问题,我不积极,但它是一个很好的开始。
你可以发布一些其他包括? CSS如何“崩溃”?你有多个jQuery包含? – barfoon
什么形式? “css崩溃”是什么意思?我们需要看到相关的代码(在问题中,而不是外部链接) –
为什么你包括在线jQuery库...而是下载jQuery库并使用它.. – diEcho