I am loading upload-media.php
file using thickbox
on front end where user can upload images to the post.
Question: How to I trigger the upload-media.php
so the link “set featured image” shows up on image manager, just like we see when we click on “set featured image” link on backend.
Here is the code for the thickbox:
jQuery('.upload_media_button').live('click', function() {
current_item = jQuery(this);
container = "."+current_item.attr('rel');
var request = url.media_upload+'?type=image&TB_iframe=true';
//alert(request);
tb_show('Image Manager', request);
return false;
});
window.send_to_editor = function(html) {
var img_tag = jQuery('img',html);
//var attachment_id = jQuery('img',html).attr('class').replace(/[^0-9]/g, '');
current_item.siblings(container).prepend(img_tag).css("height: auto");
tb_remove();
}
I know I can take the attachment ID and set the featured image after form submission but that’s the Plan B 😉