Open media box library from link

By enququing an JS file we can do like this: <img src=”#” id=”img-src”> <a href=”#” id=”img-upload”>Add Image</a> Content of JS file jQuery(document).ready(function(e){ e.preventDefault(); jQeury(‘#img-upload’).click(function(){ var upload = wp.media({ title:’Choose Image’, //Title for Media Box multiple:false //For limiting multiple image }) .on(‘select’, function(){ var select = upload.state().get(‘selection’); var attach = select.first().toJSON(); console.log(attach.id); //the attachment id of … Read more

Use the “Media Library” in Frontend

Add below code to your current theme’s function.php function add_media_upload_scripts() { if ( is_admin() ) { return; } wp_enqueue_media(); } add_action(‘wp_enqueue_scripts’, ‘add_media_upload_scripts’); Further, you can explore more in detail by follow this blog (i.e. https://codestag.com/how-to-use-wordpress-3-5-media-uploader-in-theme-options/)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)