Support » Plugins » Hacks » Add plugin to editor

  • Resolved Luismin

    (@luismin)


    Hi.

    I’m going to add a button to my WordPress Editor like a plugin. So, I need to know where is the init call to put some code in order to call to my plugin.

    Something like this plugins : "simplelink" theme_advanced_buttons1 : simplelink"

    I think It’s in “class-wp-editor.php” but I do not where. Any help?

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator bcworkz

    (@bcworkz)

    Back for more, eh? 🙂

    You have the right file, the editor HTML is output by the editor() method defined starting on line 87. There’s a few hooks that may work, most promising appears to be the filter ‘the_editor’ (line 145) which outputs the textarea for the main content, you perhaps could inject additional HTML before or after this.

    Avoid modifying core files at all cost. If you modify core files, next time you update WordPress, you’re mods will be lost.

    If you’re wanting to add buttons to the visual editor, this tutorial helped me figure it out:

    http://brettterpstra.com/2010/04/17/adding-a-tinymce-button/

    Thread Starter Luismin

    (@luismin)

    Yes bcworkz, back for jejeje. Thanks graphicgeek too.

    The thing is that I have to integrate a button thats when the user select a word from the editor and click the button this one shows a field in order to put a tag title (like the link button, URL and title) but without the URL. Other things is duplicate the link button and fix the url field.

    I found the plugin folder “wplink” but I don not know where is the ouput code (html part..).

    Still searching this line

    tinyMCE.init({
            ...
            plugins : "table,contextmenu,paste,-externalplugin"
    });
    Moderator bcworkz

    (@bcworkz)

    I had the wrong sort of button in mind, you can safely ignore my previous comment. What you want to do is within the tinyMCE editor itself, so graphicgeek’s reference is a good start. The main difference between the example and your situation is the javascript required for the button to do what you need.

    I would suggest first adding a button that does something very basic like adding “Hello!” to the editor content. Once that works properly, you can focus on determining highlighted content and doing something actually useful.

    For the record, I would never suggest anyone alter core code, I was only suggesting reviewing the source code for possible filter and action hooks to use, not directly editing the source code in any way.

    Thread Starter Luismin

    (@luismin)

    Well, I’m using my own theme so modify the code it’s not a problem.

    Now, I added the button. When the user highlight the text and click the button if the user goes to the TEXT tab he can see something like this:

    <span class="titletag" title="Add Mouse Over Text Here">paragraph</span>

    The button adds the span tag.

    But I have to know how to use the pop up function of the editor in order to add the title atributte to the highlight text from the pop up window.

    I like the hard things hehehehe.

    Thread Starter Luismin

    (@luismin)

    I found a button that makes what I want inside the TinyMCE Advanced plugin.

    Easy game! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add plugin to editor’ is closed to new replies.