Skip to content

Instantly share code, notes, and snippets.

@chipbennett
Created August 7, 2013 12:23
Show Gist options
  • Save chipbennett/6173596 to your computer and use it in GitHub Desktop.
Save chipbennett/6173596 to your computer and use it in GitHub Desktop.
Reusable add_meta_box()
// Add the Meta Box
function add_custom_meta_box() {
// Post
add_meta_box(
'cram_post_meta_box', // $id
'Additional information for the post', // $title
'add_custom_meta_box_callback', // $callback
'post', // $page
'normal', // $context
'high' // $priority
);
// Page
add_meta_box(
'cram_post_meta_box', // $id
'Additional information for the post', // $title
'add_custom_meta_box_callback', // $callback
'page', // $page
'normal', // $context
'high' // $priority
);
}
add_action('add_meta_boxes', 'add_custom_meta_box');
@Manoz
Copy link

Manoz commented Apr 11, 2014

You should add the textdomain tags for the title, no? __( 'Your title', 'Your textdomain' ), // $title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment