How to setup a [add media] button, with:
-
proper wordpress [media] UI
-
has size and alignments UI in popup right hand side
-
can custom popup title and button
-
size and alignments arguments can send back to be use
How to setup a [add media] button, with:
proper wordpress [media] UI
has size and alignments UI in popup right hand side
can custom popup title and button
size and alignments arguments can send back to be use
You must be logged in to post a comment.
Just try to cover most solutions:
use
tb_show("", "media-upload.php?type=image&TB_iframe=true");
andwindow.send_to_editor
problem: has no standard wp.media UI
in js code:
use
wp.media({frame: 'post'})
problem: cannot custom UI elements, such as: title, button
in js code:
use
wp.media.editor
withwp.media.editor.open( editor_id )
problem: cannot custom UI elements, such as: title, button
in js code: https://wordpress.stackexchange.com/questions/75808/using-wordpress-3-5-media-uploader-in-meta-box#75823
use
wp.media
with rewritewp.media.controller.Library
and retrieveattachment
inselect
problem: complicated …, but once you understand it, it all make sense, and it is my finial solution
in js code:
I would like to add to ZAC’s option 4 because when I used his code, the image src=”” was missing.
Here is the fix
This way you can call the new media uploader with custom title and button and right side bar.
Check this link -> https://github.com/phpcodingmaster/WordPress-Media-Modal-Image-Uploads
It will show you how to:
Tested with WordPress Version 6.0