WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Adding tinyMCE Editor for custom field when editing post page

[Resolved] Adding tinyMCE Editor for custom field when editing post page

  • guikubivan

    @guikubivan

    So after hours of trying to figure out the right way to add the tiny MCE editor to a custom box in the edit post page, I finally dived into the More Fields plugin to see how they do it and I hope they don’t me posting this, but this is how:

    <script type=”text/javascript”>
    jQuery(document).ready(function() {
    jQuery(“#textareaID”).addClass(“mceEditor”);
    if ( typeof( tinyMCE ) == “object” && typeof( tinyMCE.execCommand ) == “function” ) {
    tinyMCE.execCommand(“mceAddControl”, false, “textareaID”);
    }

    });
    </script>

    <textarea class=”textareaID” name=’textareaID’ id=’textareaID’>
    blah blah
    </textarea>

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thanks for that! Much appreciated, which file is the best to use this in to be unobtrusive when upgrading etc..

    Cheers

    Richard

    Thanks, saved me some time 🙂 I had a problem initially using this with my own custom fields code, the paragraph formatting didn’t seem to be retained on saving. What you need to do is run the submitted value through the wpautop function before writing it to the database. See line 214 of the more-fields-settings-object.php of the More Fields plugin…

    Can you please explain a bit where to add those line.

    Going to give this a shot. Just wondering where to add/load the javascript..

    Well just loaded TinymCE for all text area fields. But the menu bar is way too big. Need to remove certain buttons. Any ideas how?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Adding tinyMCE Editor for custom field when editing post page’ is closed to new replies.
Skip to toolbar