Hướng dẫn dùng jquery wordpress
Sau đây mình sẽ Hướng dần dùng jquery wordpress để tránh bị các loi vớ vẫn.
Đầu tiên trong file fucntions.php bao giờ bạn cùng dùng thằng này trước :
Cảm ơn bạn đã đọc bài Hướng dẫn dùng jquery wordpress
<!--?php wp_deregister_script('jquery'); wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"), false); wp_enqueue_script('jquery'); ?-->Đơn giản bao giờ làm gì cũng có thự tự. Tiếp theo để load 1 jquey nào đó cho wordpress hiểu chúng ta sẽ làm thế này tiếp theo.
<!--?php </p--> // Add RSS links to section automatic_feed_links(); // Load jQuery if ( !is_admin() ) { wp_deregister_script('jquery'); wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"), false); wp_enqueue_script('jquery'); /* register jquery & css bootstrap */ wp_register_style('boostrap_css',get_bloginfo('template_directory') .'/js/bootstrap/css/bootstrap.min.css'); wp_enqueue_style('boostrap_css'); wp_register_script('boostrap_js',get_bloginfo('template_directory') .'/js/bootstrap/js/bootstrap.min.js'); wp_enqueue_script('boostrap_js'); } ?>tức là bạn sẽ dùng hàm wp_register_script để đăng kí với wp và dùng hàm wp_enqueue_script để thực thi nó , tương tự cho css.
