TAILIEUCHUNG - Wordpress 3.0 jQuery - part 7

Tham khảo tài liệu 'wordpress jquery - part 7', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Working with jQuery in WordPress Registering jQuery in our setup Because the bundled version of jQuery that comes with WordPress also happens to be the most current version of jQuery available I ll simply navigate to wp-content themes twentyten and open up the file and use the basic wp_enqueue_script function to evoke jQuery as shown placed right above the wp_head function wp_enqueue_script jquery wp_head Registering your own custom script file Next we ll need to include a separate script file into our theme that will have our custom jQuery scripts. I would like to create a directory in the theme named js where I will keep all of my JavaScripts. Inside that directory I ll create a file and name it as . Here s the neat bit you can use wp_enqueue_script to include any script that you write. You ll do this so that you can announce that the script is dependent on jQuery and WordPress will therefore load jQuery as well if for some reason jQuery isn t loaded already You ll want to place your custom scripts below the jQuery call yet before the wp_head call. . wp_enqueue_script jquery wp_enqueue_script custom-jquery get_bloginfo stylesheet_ directory . js array jquery 20100510 wp_head In the above function wp_enqueue_script I first registered a name for my script as custom-jquery. Then in the next parameter I told WordPress where to find my script using the get_bloginfo template tag to direct WordPress to the twentyten theme s folder . js . For the third parameter of the function I set the script as dependent on jquery and in the final parameter I simply set a version number. I usually set this number as the day s date. If I update the script I try and update this date in the function and as a result when the theme renders my script loads in looking like this script type text javascript src http localhost wp-content themes twentyten js ver 20100510 script 46 Chapter 2 This helps a .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.