views:

138

answers:

1

I am creating a custom post type called Article. The article needs a field called signature that uses the Tiny MCE.

I was able to achieve this but there is an extra border that shows outside the Tiny MCE Editor.

http://webypedia.com/wp-content/uploads/2010/07/tiny-mce-custom-field.jpg

My goal is to make the signature field editor similar to the post editor.

Here is the current code I am using that produces that editor in the first image:

function admin_init(){
  add_meta_box("signature_meta", "Signature", "signature_meta", "article", "normal", "low");
}

function signature_meta() {
  global $post;
  $custom = get_post_custom($post->ID);  
  $signature = $custom["signature"][0];
  ?>    
  <div class="postbox">
  <textarea name="signature" class="signature" id='signature'><?php echo $signature; ?></textarea>
  </div>
  <script type="text/javascript">
    jQuery(document).ready(function() {
    jQuery("#signature").addClass("mceEditor");
    if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
    tinyMCE.execCommand("mceAddControl", false, "signature");
    }
    });
  </script>
  <?php
}
+1  A: 

You could hook onto the action edit_post_form (or edit_page_form for page types), which runs just after all meta boxes with 'normal' context are printed, and then simply output your TinyMCE editor.

Otherwise stick to using the meta box API, but inject a little CSS in the admin head to re-style the metabox, hiding the title and border (view source to see which selectors you have available to target).

TheDeadMedic