WordPress排队jQuery-Google CDN
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了WordPress排队jQuery-Google CDN相关的知识,希望对你有一定的参考价值。
------------------------------------------------ This must be inserted into the functions.php file: function modify_jquery() { if (!is_admin()) { // comment out the next two lines to load the local copy of jQuery wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js', false, '1.6.1'); wp_enqueue_script('jquery'); } } add_action('init', 'modify_jquery'); ------------------------------------------------ This must be inserted into the header.php file (BEFORE WP_HEAD CALL!): <?php wp_enqueue_script("jquery"); ?> ------------------------------------------------ jQuery functions should be wrapped in this so that $ operator represents no-conflict (BELOW WP_HEAD): <script type='text/javascript'> jQuery(document).ready(function($) { // $() will work as an alias for jQuery() which is noconflict mode inside of this function }); </script> ------------------------------------------------
以上是关于WordPress排队jQuery-Google CDN的主要内容,如果未能解决你的问题,请参考以下文章
在 Wordpress 插件中排队 Javascript 和 jQuery
javascript 如何在WordPress中正确排队jQuery
php WordPress:注册Gravity Forms样式表,只在联系页面#snippet #WordPress上排队