Skip to content

Instantly share code, notes, and snippets.

@tomfinitely
Created June 16, 2015 21:19
Show Gist options
  • Save tomfinitely/6f1c857bd6760d38fb84 to your computer and use it in GitHub Desktop.
Save tomfinitely/6f1c857bd6760d38fb84 to your computer and use it in GitHub Desktop.
WordPress - Move Excerpt Above Content Metabox
/* -----------------------------------------
* Put excerpt meta-box before editor
* ----------------------------------------- */
add_action( 'add_meta_boxes', 'my_add_excerpt_meta_box' );
function my_add_excerpt_meta_box( $post_type ) {
if ( in_array( $post_type, array( 'tribe_events' ) ) ) {
add_meta_box(
'contact_details_meta', __( 'Excerpt' ), 'post_excerpt_meta_box', $post_type, 'test', // change to something other then normal, advanced or side
'high'
);
}
}
add_action( 'edit_form_after_title', 'my_run_excerpt_meta_box' );
function my_run_excerpt_meta_box() {
# Get the globals:
global $post, $wp_meta_boxes;
# Output the "advanced" meta boxes:
do_meta_boxes( get_current_screen(), 'test', $post );
}
add_action( 'admin_menu' , 'my_remove_normal_excerpt' );
function my_remove_normal_excerpt() { /*this added on my own*/
remove_meta_box( 'postexcerpt' , 'post' , 'normal' );
}
//* Sort Sites in Multisite Dropdown
add_filter('get_blogs_of_user','sort_my_sites');
function sort_my_sites($blogs) {
$f = create_function('$a,$b','return strcasecmp($a->blogname,$b->blogname);');
uasort($blogs, $f);
return $blogs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment