Skip to content

Instantly share code, notes, and snippets.

@apatton-cnet
Last active December 20, 2015 04:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apatton-cnet/6072705 to your computer and use it in GitHub Desktop.
Save apatton-cnet/6072705 to your computer and use it in GitHub Desktop.
Much like Leon's additional metabox holder above the default TinyMCE editor, this will place a full width container above the text field by hacking apart the form tag via post_edit_form_tag action
<?php
add_action('post_edit_form_tag', 'ebs_seo_cp_modify_form_tag');
function ebs_seo_cp_modify_form_tag() {
$screen = get_current_screen();
if ( $screen->id != 'location') { return; } //change to custom post type
global $post;
//lets close the <form> tag
echo '>';
//insert a new sortable postbox
echo '<div id="post-head" class="metabox-holder columns-1"><div id="postbox-container-3" class="postbox-container">';
//process "head" metaboxes
do_meta_boxes( get_current_screen(), 'head', $post );
//button everything up.
echo '</div>';
//we leave the trailing > off, as it is supplied by the <form> tag we are hooked into
echo '</div';
}
?>
<script type="text/css">
/* we need to declare some CSS so wordpress recognizes our new meta box container */
#postbox-container-3 {
float:none;
}
#post-head #head-sortables {
min-height:50px;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment