WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Add plugin to editor (7 posts)

  1. Luismin
    Member
    Posted 1 year ago #

    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!

  2. bcworkz
    Member
    Posted 1 year ago #

    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.

  3. graphicgeek
    Member
    Posted 1 year ago #

    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/

  4. Luismin
    Member
    Posted 1 year ago #

    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"
    });
  5. bcworkz
    Member
    Posted 1 year ago #

    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.

  6. Luismin
    Member
    Posted 1 year ago #

    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.

  7. Luismin
    Member
    Posted 1 year ago #

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

    Easy game! :)

Topic Closed

This topic has been closed to new replies.

About this Topic