0
add_action('wp_enqueue_scripts', 'caffeine_load_scripts');
function caffeine_load_scripts(){
wp_register_script('bootstrap-modal-js' , get_stylesheet_directory_uri() . '/bootstrap/bootstrap-modal.js', array('jquery'), '1', true);
wp_register_script('bootstrap-modal-patch-js' , get_stylesheet_directory_uri() . '/bootstrap/patch/bootstrap-modal-patch.js', array('jquery'), '1', true);
wp_register_script('bootstrap-modal-manager-js' , get_stylesheet_directory_uri() . '/bootstrap/patch/bootstrap-modalmanager.js', array('jquery'), '1', true);
wp_enqueue_style('bootstrap-css', get_stylesheet_directory_uri() . "/bootstrap/bootstrap.min.css", array(), '1', 'all');
wp_enqueue_script('bootstrap-modal-js');
wp_enqueue_script('bootstrap-modal-patch-js');
wp_enqueue_script('bootstrap-modal-manager-js');
}
那麼緊隨其後的是這種格式:wp_enqueue_script不頁腳每個頁面加載像它應該
add_action('wp_enqueue_scripts', 'remove_scripts_home', 99);
function remove_scripts_home() {
if (is_front_page() || is_home()) {
//here I dequeue scripts and styles not used on home page
}
}
add_action('wp_enqueue_scripts', 'remove_scripts_about', 99);
function remove_scripts_about() {
if (is_page(412)) {
//here I dequeue scripts and styles not used on the about page
}
}
他們加載網頁上的頁腳,但他們在頭加載任何其他頁面上!
有人能告訴我爲什麼嗎?