wp_register_script – Handling Core/Custom Scripts

wp_register_script – किसी Script को Add कर लेना मा= हमारी जरूरत नहीं होती। बल्कि जरूरत के अनुसार हमें हमारी Add की गई Scripts को Manage भी करना पडता है। इसलिए Core या Custom Scripts को Manage करने से सम्बंधित जरूरतों को पूरा करने के विषय में इस Section में Discuss किया गया है।

Default Core Scripts

WordPress Installation के साथ कौन-कौन सी Scripts Default रूप से Included होती हैं, इस बात का पता लगाने के लिए हम हमारे WordPress Installation के Core Folders को Check कर सकते हैं।

/wp-includes/js/ Sub-Directory में जो Scripts होती हैं, उन Scripts को WordPress के Admin Part अथवा Public Part दोनों के लिए Use किया जा सकता है। जबकि /wp-admin/js/ Sub-Directory में Scripts Exist होती हैं, उन्हें केवल WordPress के Admin Area द्वारा ही Use किया जा सकता है।

ये सभी Core Scripts दो Versions में Exist होती हैं। पहला Version Minified Version होता है, जिसकी Size कम होती है लेकिन ये File Readable नहीं होती। जबकि दूसरी File Well Commented व Readable होती है, लेकिन इसकी Size काफी ज्यादा होती है। Default रूप से Bandwidth Save करने के लिए Minified Version की Files को ही Use किया जाता है। लेकिन Debugging Purpose के आधार पर wp-config.php File में निम्नानुसार Code Line Add करके हम WordPress के इस Default Behavior को Toggle भी कर सकते हैं:

define( SCRIPT_DEBUG, true );

सभी Core Scripts के लिए Define किए गए Handles को wp_default_scripts() Function द्वारा Define किया गया है, जो कि wp-includes/script-loader.php File में Exist है। इसलिए यदि हम चाहें तो इस Function के Source Codes को देखकर किसी Particular Core Script के Handle का पता लगा सकते हैं। फिर भी कुछ Default रूप से Exist Handles व उनसे Associated Core Scripts की Information को निम्नानुसार जाना जा सकता है:

Handle Path in WordPress
utils/wp-includes/js/utils.js
common/wp-admin/js/common.js
sack/wp-includes/js/tw-sack.js
quicktags/wp-includes/js/quicktags.js
colorpicker/wp-includes/js/colorpicker.js
editor/wp-admin/js/editor.js
wp-fullscreen/wp-admin/js/wp-fullscreen.js
wp-ajax-response/wp-includes/js/wp-ajax-response.js
wp-pointer/wp-includes/js/wp-pointer.js
autosave/wp-includes/js/autosave.js
heartbeat/wp-includes/js/heartbeat.js
wp-auth-check/wp-includes/js/wp-auth-check.js
wp-lists/wp-includes/js/wp-lists.js
prototypeexternal: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js
scriptaculous-rootexternal: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js
scriptaculous-builderexternal: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/builder.js
scriptaculous-dragdropexternal: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/dragdrop.js
scriptaculous-effectsexternal: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/effects.js
scriptaculous-sliderexternal: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/slider.js
scriptaculous-soundexternal: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/sound.js
scriptaculous-controlsexternal: //ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/controls.js
scriptaculousscriptaculous-dragdrop, scriptaculous-slider, scriptaculous-controls
cropper/wp-includes/js/crop/cropper.js
jquery (v1.10.2 as of WP 3.8)jquery-core, jquery-migrate
jquery-core/wp-includes/js/jquery/jquery.js
jquery-migrate/wp-includes/js/jquery/jquery-migrate.js (v1.10.2 as of WP 3.8)
jquery-ui-core/wp-includes/js/jquery/ui/jquery.ui.core.min.js
jquery-effects-core/wp-includes/js/jquery/ui/jquery.ui.effect.min.js
jquery-effects-blind/wp-includes/js/jquery/ui/jquery.ui.effect-blind.min.js
jquery-effects-bounce/wp-includes/js/jquery/ui/jquery.ui.effect-bounce.min.js
jquery-effects-clip/wp-includes/js/jquery/ui/jquery.ui.effect-clip.min.js
jquery-effects-drop/wp-includes/js/jquery/ui/jquery.ui.effect-drop.min.js
jquery-effects-explode/wp-includes/js/jquery/ui/jquery.ui.effect-explode.min.js
jquery-effects-fade/wp-includes/js/jquery/ui/jquery.ui.effect-fade.min.js
jquery-effects-fold/wp-includes/js/jquery/ui/jquery.ui.effect-fold.min.js
jquery-effects-highlight/wp-includes/js/jquery/ui/jquery.ui.effect-highlight.min.js
jquery-effects-pulsate/wp-includes/js/jquery/ui/jquery.ui.effect-pulsate.min.js
jquery-effects-scale/wp-includes/js/jquery/ui/jquery.ui.effect-scale.min.js
jquery-effects-shake/wp-includes/js/jquery/ui/jquery.ui.effect-shake.min.js
jquery-effects-slide/wp-includes/js/jquery/ui/jquery.ui.effect-slide.min.js
jquery-effects-transfer/wp-includes/js/jquery/ui/jquery.ui.effect-transfer.min.js
jquery-ui-accordion/wp-includes/js/jquery/ui/jquery.ui.accordion.min.js
jquery-ui-autocomplete/wp-includes/js/jquery/ui/jquery.ui.autocomplete.min.js
jquery-ui-button/wp-includes/js/jquery/ui/jquery.ui.button.min.js
jquery-ui-datepicker/wp-includes/js/jquery/ui/jquery.ui.datepicker.min.js
jquery-ui-dialog/wp-includes/js/jquery/ui/jquery.ui.dialog.min.js
jquery-ui-draggable/wp-includes/js/jquery/ui/jquery.ui.draggable.min.js
jquery-ui-droppable/wp-includes/js/jquery/ui/jquery.ui.droppable.min.js
jquery-ui-menu/wp-includes/js/jquery/ui/jquery.ui.menu.min.js
jquery-ui-mouse/wp-includes/js/jquery/ui/jquery.ui.mouse.min.js
jquery-ui-position/wp-includes/js/jquery/ui/jquery.ui.position.min.js
jquery-ui-progressbar/wp-includes/js/jquery/ui/jquery.ui.progressbar.min.js
jquery-ui-resizable/wp-includes/js/jquery/ui/jquery.ui.resizable.min.js
jquery-ui-selectable/wp-includes/js/jquery/ui/jquery.ui.selectable.min.js
jquery-ui-slider/wp-includes/js/jquery/ui/jquery.ui.slider.min.js
jquery-ui-sortable/wp-includes/js/jquery/ui/jquery.ui.sortable.min.js
jquery-ui-spinner/wp-includes/js/jquery/ui/jquery.ui.spinner.min.js
jquery-ui-tabs/wp-includes/js/jquery/ui/jquery.ui.tabs.min.js
jquery-ui-tooltip/wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js
jquery-ui-widget/wp-includes/js/jquery/ui/jquery.ui.widget.min.js
jquery-form/wp-includes/js/jquery/jquery.form.js
jquery-color/wp-includes/js/jquery/jquery.color.min.js
suggest/wp-includes/js/jquery/suggest.js
schedule/wp-includes/js/jquery/jquery.schedule.js
jquery-query/wp-includes/js/jquery/jquery.query.js
jquery-serialize-object/wp-includes/js/jquery/jquery.serialize-object.js
jquery-hotkeys/wp-includes/js/jquery/jquery.hotkeys.js
jquery-table-hotkeys/wp-includes/js/jquery/jquery.table-hotkeys.js
jquery-touch-punch/wp-includes/js/jquery/jquery.ui.touch-punch.js
jquery-masonry/wp-includes/js/jquery/jquery.masonry.min.js
thickbox/wp-includes/js/thickbox/thickbox.js
jcrop/wp-includes/js/jcrop/jquery.Jcrop.js
swfobject/wp-includes/js/swfobject.js
plupload/wp-includes/js/plupload/plupload.js
plupload-html5wp-includes/js/plupload/plupload.html5.js
plupload-flash/wp-includes/js/plupload/plupload.flash.js
plupload-silverlight/wp-includes/js/plupload/plupload.silverlight.js
plupload-html4/wp-includes/js/plupload/plupload.html4.js
plupload-allplupload, plupload-html5, plupload-flash, plupload-silverlight, plupload-html4
plupload-handlers/wp-includes/js/plupload/handlers.js
wp-plupload/wp-includes/js/plupload/wp-plupload.js
swfupload/wp-includes/js/swfupload/swfupload.js
swfupload-swfobject/wp-includes/js/swfupload/plugins/swfupload.swfobject.js
swfupload-queue/wp-includes/js/swfupload/plugins/swfupload.queue.js
swfupload-speed/wp-includes/js/swfupload/plugins/swfupload.speed.js
swfupload-all/wp-includes/js/swfupload/swfupload-all.js
swfupload-handlers/wp-includes/js/swfupload/handlers.js
comment-reply/wp-includes/js/comment-reply.js
json2/wp-includes/js/json2.js
underscore/wp-includes/js/underscore.min.js
backbone/wp-includes/js/backbone.min.js
wp-util/wp-includes/js/wp-util.js
wp-backbone/wp-includes/js/wp-backbone.js
revisions/wp-admin/js/revisions.js
imgareaselect/wp-includes/js/imgareaselect/jquery.imgareaselect.js
mediaelement/wp-includes/js/mediaelement/mediaelement-and-player.min.js
wp-mediaelement/wp-includes/js/mediaelement/wp-mediaelement.js
zxcvbn-async/wp-includes/js/zxcvbn-async.js
password-strength-meter/wp-admin/js/password-strength-meter.js
user-profile/wp-admin/js/user-profile.js
user-suggest/wp-admin/js/user-suggest.js
admin-bar/wp-includes/js/admin-bar.js
wplink/wp-includes/js/wplink.js
wpdialogs/wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.js
wpdialogs-popup/wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js
word-count/wp-admin/js/word-count.js
media-upload/wp-admin/js/media-upload.js
hoverIntent/wp-includes/js/hoverIntent.js
customize-base/wp-includes/js/customize-base.js

जबकि WordPress की विभिन्न Core Scripts को उनकी Dependency Information के साथ निम्नानुसार Specify किया जा सकता है:

Script Name Handle Needed Dependency *
Image CropperImage cropper (not used in core, see jcrop)
Jcropjcrop
SWFObjectswfobject
SWFUploadswfupload
SWFUpload Degradeswfupload-degrade
SWFUpload Queueswfupload-queue
SWFUpload Handlersswfupload-handlers
jQueryjqueryjson2 (for AJAX calls)
jQuery Formjquery-formjquery
jQuery Colorjquery-colorjquery
jQuery Masonryjquery-masonryjquery
jQuery UI Corejquery-ui-corejquery
jQuery UI Widgetjquery-ui-widgetjquery
jQuery UI Mousejquery-ui-mousejquery
jQuery UI Accordionjquery-ui-accordionjquery
jQuery UI Autocompletejquery-ui-autocompletejquery
jQuery UI Sliderjquery-ui-sliderjquery
jQuery UI Progressbarjquery-ui-progressbarjquery
jQuery UI Tabsjquery-ui-tabsjquery
jQuery UI Sortablejquery-ui-sortablejquery
jQuery UI Draggablejquery-ui-draggablejquery
jQuery UI Droppablejquery-ui-droppablejquery
jQuery UI Selectablejquery-ui-selectablejquery
jQuery UI Positionjquery-ui-positionjquery
jQuery UI Datepickerjquery-ui-datepickerjquery
jQuery UI Tooltipsjquery-ui-tooltipjquery
jQuery UI Resizablejquery-ui-resizablejquery
jQuery UI Dialogjquery-ui-dialogjquery
jQuery UI Buttonjquery-ui-buttonjquery
jQuery UI Effectsjquery-effects-corejquery
jQuery UI Effects – Blindjquery-effects-blindjquery-effects-core
jQuery UI Effects – Bouncejquery-effects-bouncejquery-effects-core
jQuery UI Effects – Clipjquery-effects-clipjquery-effects-core
jQuery UI Effects – Dropjquery-effects-dropjquery-effects-core
jQuery UI Effects – Explodejquery-effects-explodejquery-effects-core
jQuery UI Effects – Fadejquery-effects-fadejquery-effects-core
jQuery UI Effects – Foldjquery-effects-foldjquery-effects-core
jQuery UI Effects – Highlightjquery-effects-highlightjquery-effects-core
jQuery UI Effects – Pulsatejquery-effects-pulsatejquery-effects-core
jQuery UI Effects – Scalejquery-effects-scalejquery-effects-core
jQuery UI Effects – Shakejquery-effects-shakejquery-effects-core
jQuery UI Effects – Slidejquery-effects-slidejquery-effects-core
jQuery UI Effects – Transferjquery-effects-transferjquery-effects-core
MediaElement.js (WP 3.6+)wp-mediaelementjquery
jQuery Scheduleschedulejquery
jQuery Suggestsuggestjquery
ThickBoxthickbox
jQuery HoverIntenthoverIntentjquery
jQuery Hotkeysjquery-hotkeysjquery
Simple AJAX Code-Kitsack
QuickTagsquicktags
Iris (Colour picker)irisjquery
Farbtastic (deprecated)farbtasticjquery
ColorPicker (deprecated)colorpickerjquery
Tiny MCEtiny_mce
Autosaveautosave
WordPress AJAX Responsewp-ajax-response
List Manipulationwp-lists
WP Commoncommon
WP Editoreditorremov
WP Editor Functionseditor-functions
AJAX Catajaxcat
Admin Categoriesadmin-categories
Admin Tagsadmin-tags
Admin custom fieldsadmin-custom-fields
Password Strength Meterpassword-strength-meter
Admin Commentsadmin-comments
Admin Usersadmin-users
Admin Formsadmin-forms
XFNxfn
Uploadupload
PostBoxpostbox
Slugslug
Postpost
Pagepage
Linklink
Commentcomment
Threaded Commentscomment-reply
Admin Galleryadmin-gallery
Media Uploadmedia-upload
Admin widgetsadmin-widgets
Word Countword-count
Theme Previewtheme-preview
JSON for JSjson2
Plupload Coreplupload
Plupload All Runtimesplupload-all
Plupload HTML4plupload-html4
Plupload HTML5plupload-html5
Plupload Flashplupload-flash
Plupload Silverlightplupload-silverlight
Underscore jsunderscore
Backbone jsbackbone

Read more…

  • Removing Queued Script
  • Replacing Core Scripts
  • Registering and Enqueuing Scripts
WP Enqueue Script - jQuery Ajax WordPress
wp_register_style - Managing Stylesheets in WordPress

WordPress in Hindi - BccFalna.comये Article इस वेबसाईट पर Selling हेतु उपलब्‍ध EBook Advance WordPress in Hindi से लिया गया है। इसलिए यदि ये Article आपके लिए उपयोगी है, तो निश्चित रूप से ये EBook भी आपके लिए काफी उपयोगी साबित होगी।

Advance WordPress in Hindi | Page: 835 | Format: PDF

BUY NOW GET DEMO REVIEWS