Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm working on creating a custom content type but I'm having a bit of a problem formatting the create and edit views. I want to disable the main editor and focus only on the title, excerpt, and custom fields. I have the following jQuery code that will add the WYSIWYG to my custom fields, and that works fine:

<script type="text/javascript">
        /* <![CDATA[ */

        jQuery(document).ready( function () {
            if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
                tinyMCE.execCommand("mceAddControl", true, "solution_problem");
                tinyMCE.execCommand("mceAddControl", true, "solution_solution");
                tinyMCE.execCommand("mceAddControl", true, "solution_people");

            }
        });

        /* ]]> */
</script>

But then when I remove the editor from the 'supports' argument in *register_post_type*:

'supports' => array('title','thumbnail','excerpt'), 'taxonomies' => array('category', 'post_tag')

The default editor disappears but so do my custom WYSIWYGs. Anybody have any idea why this might be happening? Thanks!

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I just had the exact same issue. You have to include the editor in the supports argument array to get custom mce boxes to show.

I solved the issue by hiding it with CSS:

function move_posteditor( $hook ) {
    if ( $hook == 'post.php' OR $hook == 'post-new.php' ) {             
        add_action( 'admin_print_footer_scripts', 'remove_edit_div' );
    }
}
add_action( 'admin_enqueue_scripts', 'move_posteditor', 10, 1 );

    function remove_edit_div() {
        global $post;
        $post_type=get_post_type( $post->ID );
            if ( ( $_GET[ 'post_type' ] ) == 'custom_pt_name'  || (  $post_type == 'custom_pt_name') ) {
            ?>


                <style>#postdivrich { display: none; }</style>

    <?php }
share|improve this answer
    
Hmmmm ... I think I see what you're trying to do there, but the code is returning a HTTP Error 500 I can't trace (replacing the OR in the second line didn't do the trick) –  mcleodm3 Nov 3 '11 at 19:40
    
Turns out that I can just add <style>#postdivrich { display: none; }</style> directly into the form and the editor is disappeared, no need for anything else. Thanks! –  mcleodm3 Nov 3 '11 at 20:13

You really don't even have to do that, if you just enqueue the correct tiny-mce js and css files, you should be fine on actually removing the editor from the post-type supports array.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.