WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding tinyMCE Editor for custom field when editing post page (6 posts)

  1. guikubivan
    Member
    Posted 4 years ago #

    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>

  2. mackstar
    Member
    Posted 4 years ago #

    Thanks for that! Much appreciated, which file is the best to use this in to be unobtrusive when upgrading etc..

    Cheers

    Richard

  3. Steve Taylor
    Member
    Posted 3 years ago #

    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...

  4. Alvaro
    Member
    Posted 3 years ago #

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

  5. Rhand
    Member
    Posted 3 years ago #

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

  6. Rhand
    Member
    Posted 3 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic