I am adding two custom metaboxes to the WordPress post page from a plugin. I am currently doing it with two separate instances of add_meta_boxes but this feels very bulky, especially as I go to add more.Since the plugin is fairly small I dont want to include a framework and was wondering if there was an easier to add more than one metabox. Preferably under one heading, unlike currently if you add this to your functions.php or look at the screenshot below, they are under separate headings.I was considering posting this on http://wordpress.stackexchange.com, but as it is working fully I posted it here.function wp_cat_map_add_meta_box() {$screens = array( 'post' );foreach ( $screens as $screen ) {    add_meta_box( 'map_lat', __( 'Add Latitude', 'wp_cat_map' ), 'wp_cat_map_lat_callback', $screen );    add_meta_box( 'map_long', __( 'Add Longitude', 'wp_cat_map' ), 'wp_cat_map_long_callback', $screen );}}add_action( 'add_meta_boxes', 'wp_cat_map_add_meta_box' );function wp_cat_map_lat_callback( $post ) {wp_nonce_field( 'wp_cat_map_lat_data', 'wp_cat_map_lat_nonce' );$value = get_post_meta( $post->ID, '_wp_cat_map_lat', true );echo '<label for=wp_cat_map_lat>';_e( 'Latitude', 'wp_cat_map' );echo '</label> ';echo '<input type=text id=wp_cat_map_lat name=wp_cat_map_lat value=' . esc_attr( $value ) . '/>';}function wp_cat_map_lat_data( $post_id ) {if ( ! isset( $_POST['wp_cat_map_lat_nonce'] ) ) {    return;}if ( ! wp_verify_nonce( $_POST['wp_cat_map_lat_nonce'], 'wp_cat_map_lat_data' ) ) {    return;}if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {    return;}if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {    if ( ! current_user_can( 'edit_page', $post_id ) ) {        return;    }} else {    if ( ! current_user_can( 'edit_post', $post_id ) ) {        return;    }}if ( ! isset( $_POST['wp_cat_map_lat'] ) ) {    return;}$my_data = sanitize_text_field( $_POST['wp_cat_map_lat'] );update_post_meta( $post_id, '_wp_cat_map_lat', $my_data );}function wp_cat_map_long_callback( $post ) {wp_nonce_field( 'wp_cat_map_long_data', 'wp_cat_map_long_nonce' );$value = get_post_meta( $post->ID, '_wp_cat_map_long', true );echo '<label for=wp_cat_map_long>';_e( 'Longitude', 'wp_cat_map' );echo '</label> ';echo '<input type=text id=wp_cat_map_long name=wp_cat_map_long value=' . esc_attr( $value ) . '/>';}function wp_cat_map_long_data( $post_id ) {if ( ! isset( $_POST['wp_cat_map_long_nonce'] ) ) {    return;}if ( ! wp_verify_nonce( $_POST['wp_cat_map_long_nonce'], 'wp_cat_map_long_data' ) ) {    return;}if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {    return;}if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {    if ( ! current_user_can( 'edit_page', $post_id ) ) {        return;    }} else {    if ( ! current_user_can( 'edit_post', $post_id ) ) {        return;    }}if ( ! isset( $_POST['wp_cat_map_long'] ) ) {    return;}$my_data = sanitize_text_field( $_POST['wp_cat_map_long'] );update_post_meta( $post_id, '_wp_cat_map_long', $my_data );}add_action( 'save_post', 'wp_cat_map_lat_data' );add_action( 'save_post', 'wp_cat_map_long_data' ); 
Adding Wordpress Meta boxes
php;wordpress