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 ?
This will allow the post editor to be moved like the other sortable post boxes.
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.Thanks to Andrew’s solution here.
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)Have you tried to set
$priority
tohigh
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.