Hope this code may be help you.
You can read the full parameters for add_meta_box in the codex. I also
listed them here:
add_meta_box( $id, $title, $callback, $page, $context, $priority, $callback_args );
function wpt_add_event_metaboxes() {
add_meta_box(
'wpt_events_location', // $id
'Event Location', // $title
'wpt_events_location', // $callback
'events', // $page (Post Type)
'side', // $context
'default' // $priority
);
}
add_action( 'add_meta_boxes', 'wpt_add_event_metaboxes' );
For the example above:
- $id is “wpt_events_location”- or the html id that will be applied to
this metabox. - $title is “Event Location”. This appears at the top of the new
metabox when displayed. - $callback is the function “wpt_events_location” which will load the
html into the metabox. - $page is “events”, the name of our custom post type.
- $context is “side”. If you wanted it to load below the content area,
you could put “normal”. - $priority controls where the metabox will display in relation to the
other metaboxes. You can put “high”, “low” or “default”.