Back to Browse

Wordpress Plugin Development tutorial from scratch (Part 22) Uploading from media library to plugin

9.0K views
Jan 11, 2018
23:14

In this video session we have discussed about uploading from Media library to plugin. As we know default input type file redirect us to get any files from our local system. #WordpressTutorialsPoint #WordpressLearnersHub #WordpressCustomizations #LearnWordpressStepbyStep #WordpressBySanjay So to make selection from media library. We need to use 1. wp_enqueue_media() wp_enqueue_media( array $args = array() ) Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. define this wp function to wp file to make use of wp.media(); 2. wp.media({}) in javascript here are some parameters we need to know while using it, Syntax for using it. =================== var datas = wp.media({ title: "your media library title", multiple: true or false }).open().on("select",function(){ var allfiles = datas.state().get("selection"); }); Have a look the complete code. jQuery(function() { jQuery("#btnImage").on("click", function() { var images = wp.media({ title: "Upload Image", multiple: false }).open().on("select", function(e) { var uploadedImages = images.state().get("selection").first(); var selectedImages = uploadedImages.toJSON(); jQuery("#getImage").attr("src", selectedImages.url); //console.log(selectedImages.title + " " + selectedImages.url + " " + selectedImages.filename); /*selectedImages.map(function(image){ var itemDetails = image.toJSON(); console.log(itemDetails.url); });*/ }); }); }); Important Videos from Plugin Development Series =============== About Shortcodes in wordpress: https://www.youtube.com/watch?v=F9Woyst2fr8 Ajax Request in wordpress by wp_ajax_{action_name}: https://www.youtube.com/watch?v=RAwahYG8Qfc Insert data from form to wordpress database table: https://www.youtube.com/watch?v=UxBDUzQHeMY Create Wordpress page on Plugin Activation: https://www.youtube.com/watch?v=oL8ffxggYZY SOCIAL : =============== Subscribe : https://www.youtube.com/channel/UCB2flCo-gW6RhpVVXySqcMg FACEBOOK : https://www.facebook.com/onlinewebtutorhub/ TWITTER: https://twitter.com/owthub BLOG: https://onlinewebtutorhub.blogspot.in/ Also you can learn Wordpress Custom =============== Wordpress Theme Development: https://goo.gl/MZ8maF Wordpress Widget Development: https://goo.gl/Dc2htn Wordpress Plugin Development: https://goo.gl/BA7dYG Wordpress Theme Options Development: https://goo.gl/Vjv3Ub Learn backbone.js here! : https://goo.gl/Qd2Pcs Tags =============== online web tutor, profotech solutions, wordpress plugin development from scratch in hindi, wordpress plugin development from scratch in easy steps, wordpress plugin development, wordpress plugin development in easy steps, plugin development in wordpress from scratch in hindi, plugin development in wordpress by online web tutor, plugin development in wordpress tutorials from scratch in hindi, plugin theme development tutorials in hindi, plugin development tutorials in hindi, owt tuts, online web tutorials, Thanks Online Web Tutor Keep learning and Sharing :)

Download

0 formats

No download links available.

Wordpress Plugin Development tutorial from scratch (Part 22) Uploading from media library to plugin | NatokHD