Thứ Hai, 23 tháng 9, 2013

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 :
[code type=php]

[/code]
Đơ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.
[code type=php]


// 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');
}
?>
[/code]
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.

Thiết kế website
Cảm ơn bạn đã đọc bài Hướng dẫn dùng jquery wordpress
Share This

Không có nhận xét nào:

Đăng nhận xét

Contact Us

Biểu mẫu liên hệ

Tên

Email *

Thông báo *

Created By Thiết kế web wordpress and Thiết kế web giá rẻ tphcm