WordPress默认包含了很多Web开发人员常用的js脚本库,这意味着我们开发主题的时候可以直接引用这些库,而不用再一个一个查找,然后写代码引用了.
既然包含在WordPress中了调用起来也是相当方便的,我们可以通过以下代码引入WordPress内置的这些js库.
function my_scripts_method() {
wp_enqueue_script( 'scriptaculous' ); //库的句柄
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
以下是一部分WordPress自带的js库,可是说是相当实用了.
脚本名称 | 句柄 | 依赖脚本 * |
---|---|---|
Image Cropper | Image cropper (not used in core, see jcrop) | |
Jcrop | jcrop | |
SWFObject | swfobject | |
SWFUpload | swfupload | |
SWFUpload Degrade | swfupload-degrade | |
SWFUpload Queue | swfupload-queue | |
SWFUpload Handlers | swfupload-handlers | |
jQuery | jquery | json2 (for AJAX calls) |
jQuery Form | jquery-form | jquery |
jQuery Color | jquery-color | jquery |
jQuery Masonry | jquery-masonry | jquery |
jQuery UI Core | jquery-ui-core | jquery |
jQuery UI Widget | jquery-ui-widget | jquery |
jQuery UI Mouse | jquery-ui-mouse | jquery |
jQuery UI Accordion | jquery-ui-accordion | jquery |
jQuery UI Autocomplete | jquery-ui-autocomplete | jquery |
jQuery UI Slider | jquery-ui-slider | jquery |
jQuery UI Progressbar | jquery-ui-progressbar | jquery |
jQuery UI Tabs | jquery-ui-tabs | jquery |
jQuery UI Sortable | jquery-ui-sortable | jquery |
jQuery UI Draggable | jquery-ui-draggable | jquery |
jQuery UI Droppable | jquery-ui-droppable | jquery |
jQuery UI Selectable | jquery-ui-selectable | jquery |
jQuery UI Position | jquery-ui-position | jquery |
jQuery UI Datepicker | jquery-ui-datepicker | jquery |
jQuery UI Tooltips | jquery-ui-tooltip | jquery |
jQuery UI Resizable | jquery-ui-resizable | jquery |
jQuery UI Dialog | jquery-ui-dialog | jquery |
jQuery UI Button | jquery-ui-button | jquery |
jQuery UI Effects | jquery-effects-core | jquery |
jQuery UI Effects – Blind | jquery-effects-blind | jquery-effects-core |
jQuery UI Effects – Bounce | jquery-effects-bounce | jquery-effects-core |
jQuery UI Effects – Clip | jquery-effects-clip | jquery-effects-core |
jQuery UI Effects – Drop | jquery-effects-drop | jquery-effects-core |
jQuery UI Effects – Explode | jquery-effects-explode | jquery-effects-core |
jQuery UI Effects – Fade | jquery-effects-fade | jquery-effects-core |
jQuery UI Effects – Fold | jquery-effects-fold | jquery-effects-core |
jQuery UI Effects – Highlight | jquery-effects-highlight | jquery-effects-core |
jQuery UI Effects – Pulsate | jquery-effects-pulsate | jquery-effects-core |
jQuery UI Effects – Scale | jquery-effects-scale | jquery-effects-core |
jQuery UI Effects – Shake | jquery-effects-shake | jquery-effects-core |
jQuery UI Effects – Slide | jquery-effects-slide | jquery-effects-core |
jQuery UI Effects – Transfer | jquery-effects-transfer | jquery-effects-core |
MediaElement.js (WP 3.6+) | wp-mediaelement | jquery |
jQuery Schedule | schedule | jquery |
jQuery Suggest | suggest | jquery |
ThickBox | thickbox | |
jQuery HoverIntent | hoverIntent | jquery |
jQuery Hotkeys | jquery-hotkeys | jquery |
Simple AJAX Code-Kit | sack | |
QuickTags | quicktags | |
Iris (Colour picker) | iris | jquery |
Farbtastic (deprecated) | farbtastic | jquery |
ColorPicker (deprecated) | colorpicker | jquery |
Tiny MCE | tiny_mce | |
Autosave | autosave | |
WordPress AJAX Response | wp-ajax-response | |
List Manipulation | wp-lists | |
WP Common | common | |
WP Editor | editorremov | |
WP Editor Functions | editor-functions | |
AJAX Cat | ajaxcat | |
Admin Categories | admin-categories | |
Admin Tags | admin-tags | |
Admin custom fields | admin-custom-fields | |
Password Strength Meter | password-strength-meter | |
Admin Comments | admin-comments | |
Admin Users | admin-users | |
Admin Forms | admin-forms | |
XFN | xfn | |
Upload | upload | |
PostBox | postbox | |
Slug | slug | |
Post | post | |
Page | page | |
Link | link | |
Comment | comment | |
Threaded Comments | comment-reply | |
Admin Gallery | admin-gallery | |
Media Upload | media-upload | |
Admin widgets | admin-widgets | |
Word Count | word-count | |
Theme Preview | theme-preview | |
JSON for JS | json2 | |
Plupload Core | plupload | |
Plupload All Runtimes | plupload-all | |
Plupload HTML4 | plupload-html4 | |
Plupload HTML5 | plupload-html5 | |
Plupload Flash | plupload-flash | |
Plupload Silverlight | plupload-silverlight | |
Underscore js | underscore | |
Backbone js | backbone |