I need to add a mailto button to TinyMCE in WordPress. Has anybody already done this? Or any tops on how to go about it?
Leave a Reply
You must be logged in to post a comment.
I need to add a mailto button to TinyMCE in WordPress. Has anybody already done this? Or any tops on how to go about it?
You must be logged in to post a comment.
Given you are wanting to put this into WordPress I assume you want to simply insert a href=”mailto:” type tag into your document for the currently selected text.
The simplest way is to create a basic plugin. You can do this in the same page that tinyMCE is initialised into. The example below will wrap the currently selected text with a static mailto.
You will of course need to create an image (mailto.gif) for the toolbar button.
You then simply add the following to your plugin list
and put mailto on the toolbar.
Of course, if you want to allow the end user to specify the email address and subject, then you will need a dialog. There is a good example of how to create a plugin on the TinyMCE site in Creating a Plugin
Unfortunately I can’t comment on how you would do either of these in WordPress but I suspect you will need to customise your version of WordPress tinyMCE plugin.
You can use the class I built in WordPress my tutorial and then make the calls to your javascript files through instantiating the class. At least, regarding the reference to adding it to your plugins.
Cheers
First of all, make sure you have tinyMce Advanced plugin installed. Then, you can just use the insert / edit link button from the tinyMce editor. You don’t need a different button. In the destination URL add this