开发者

print javascript only to front end

I'm developing a wordpress app that I will always have full control over. I want to make sure that I have control over the jquery version. So I have a plugin that re-registers jquery:

wp_deregister_script('jquery');
wp_deregister_script('jquery-ui-core');
wp_register_script('jquery', URL_CONSTANT . "/application/includes/jquery-ui-1.8.13/js/jquery-1.5.1.min.js");
wp_register_script('jquery-ui-core', URL_CONSTANT . "/application/includes/jquery-ui-1.8.13/js/jquery-ui-1.8.13.custom.min.js", array('jquery'));

Now everybody's gonna see what just happened when I went into the dashboard, lol. I'm getting a jQuery not defined error and nothing will work.

Has anybody got any ideas of how I should tackle this problem. One suggestion I have is to replace the jquery file in the wp-includes folder (or where ever it is), but I don开发者_如何学编程't want to have to do this for every update I do to wordpress.

any suggestions appreciated, daithi


You can bundle your own jquery version with your app so that you don't need to worry about the version shipped with wordpress. Taking over the wordpress jquery version would be a very bad thing to do.

This guy talks about the proper way to use jQuery with plugins. Read all the way to the end. #5 is the most relevant to you.

http://www.ericmmartin.com/5-tips-for-using-jquery-with-wordpress/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜