1

I've created my own plugin for WordPress, but it's not completely functional. My goal is to add an additional button to the Post Editor that allows you to insert an image (that you upload from your computer, and automatically gets modified after upload) into the post.

When you click on the button, my popup that I created in my plugin shows up. I go through the upload process and the image is uploaded and modified. Now, how do I insert the image into the post?

This is my code so far:

function insertHeader(imageURL){
    text = '<div style="text-align:center;"><img src="'+imageURL+'"/></div>';
    tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, text);
}

But obviously it doesn't work. I can't seem to find a good tutorial that shows you how. I've got this far just by looking at other plugins.

1 Answer 1

0

try getting idea from the media-upload.php and upload.php of wp-admin

1
  • Can you be more specific with this answer by pointing out areas of those files that would be most helpful to the question.
    – John K
    Aug 10, 2012 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.