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 want to reorder stuff in a custom post. I got the meta box and editor working together, but currently the editor is above the meta box
and I need it to be the other way around.

This is the code for my meta box:

// adding the meta boxes
add_action("admin_init", "tl_admin_init");
function tl_admin_init(){
  add_meta_box("testimonial_description-meta", __('Testimonial Description', 'sagive'), "testimonial_description", "testimonial", "normal", "core");
}


// getting, setting and displaying PROJECT DESCRIPTION meta box
function testimonial_description() {
    global $post; // this is a must!
    $custom = get_post_custom($post->ID); // this is a must!
    $testimonial_description = $custom["testimonial_description"][0];
    ?>
    <textarea name="testimonial_description" style="width: 98%; height: 10em; " /><?php echo $testimonial_description; ?></textarea>
    <label><?php _e('Write a Simple 2 Line Description of your client testimonial without html for clean design.', 'sagive'); ?></label>
    <?php
}

I tried removing the editor and re-instating after this function
but I guess that`s an over simplistic solution since it doesn't work.

I've removed the editor using this:

/* This will help me get rid of the editor */
function tl_remove_pages_editor(){
    remove_post_type_support( 'testimonial', 'editor' );
}   
add_action( 'init', 'tl_remove_pages_editor' );

Then added it again using add_post_type_supports

Any suggestions anyone ?

share|improve this question

marked as duplicate by G. M., Johannes Pille, mrwweb, Tom J Nowell Sep 11 at 0:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
-1 for the rollback. No meaning was lost, and readability was improved, see no reason to have rolled back the question. –  t31os Dec 3 '11 at 14:50
    
you just went on my answers - answer by answer one at a time and changed them -** but only one char.. ** thats not nice.. i understand you like those badges man but comeon.. Then.. you went and -1 all my answers? - i dont mean to be rude but thats acting like a child.. i could have done the same but i dont really care enough :) - just didnt understand why you acted like that.. you seem like a guy that helps - whatever.. –  Sagive SEO Dec 4 '11 at 2:33
    
What???.. I make edits to anyone and everyone's answers or questions(that's how Stack Exchange sites operate), i don't go about making edits to just your answers, despite whatever you may think i'm not giving you any special treatment. –  t31os Dec 4 '11 at 21:32
    
this is probably what you're looking for :-) wordpress.stackexchange.com/questions/38562/… –  Dipesh Kc Oct 17 '12 at 8:42
    
Another very similar question here: wordpress.stackexchange.com/questions/36600/… –  Simon Aug 29 at 1:52

4 Answers 4

up vote 5 down vote accepted

This will allow the post editor to be moved like the other sortable post boxes.

function move_posteditor( $hook ) {
    if ( $hook == 'post.php' OR $hook == 'post-new.php' ) {
        wp_enqueue_script( 'jquery' );
        add_action('admin_print_footer_scripts', 'move_posteditor_scripts');

    }
}
add_action( 'admin_enqueue_scripts', 'move_posteditor', 10, 1 );

function move_posteditor_scripts() {
    ?>
    <script type="text/javascript">
        jQuery('#postdiv, #postdivrich').prependTo('#your_meta_box_id .inside' );
</script>
<?php }
share|improve this answer
    
10x a lot man.. it took a little tingeling to work with my custom post type but that did the trick - you the man! :) –  Sagive SEO Dec 3 '11 at 22:46
1  
This is a pretty evil hack but it does work well, remember to change #your_meta_box_id to the name of the metabox you created with: add_meta_box("your_meta_box_id", "Editor Title", array(&$this, "editor"), "your_post_type", "normal", "core"); –  Jona Feb 10 '12 at 15:52

Have you tried to set $priority to high and change context?

If this is not helping - there is a hack you could use - which is to MOVE the editor INSIDE a meta-box and then you can place it as you like.

share|improve this answer

This is the simplest method I have found.

When creating your metabox, simply set the context to "advanced". Then, latch on to the edit_form_after_title hook - print your meta boxes out there, then remove it so it doesn't appear twice.

// Move all "advanced" metaboxes above the default editor
add_action('edit_form_after_title', function() {
    global $post, $wp_meta_boxes;
    do_meta_boxes(get_current_screen(), 'advanced', $post);
    unset($wp_meta_boxes[get_post_type($post)]['advanced']);
});

Thanks to Andrew's solution here.

share|improve this answer

This solution from WordPress.org forums worked perfectly for me and without any JS. I modified it to only target a single CPT, so in the code below replace {post-type} with the post type you want to target: post, page, my_custom_post_type, etc... (If that's confusing see the referenced link to .org for that standard page/post example)

add_action( 'add_meta_boxes', 'jb_make_wp_editor_movable', 0 );
function jb_make_wp_editor_movable() {
    global $_wp_post_type_features;
    if (isset($_wp_post_type_features['{post-type}']['editor']) && $_wp_post_type_features['{post-type}']['editor']) {
        unset($_wp_post_type_features['{post-type}']['editor']);
        add_meta_box(
            'description_sectionid',
            __('Description'),
            'jb_inner_custom_box',
            '{post-type}', 'normal', 'high'
        );
    }
}
function jb_inner_custom_box( $post ) {
    the_editor($post->post_content);
}
share|improve this answer

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