0

How can i add a custom meta box below publish box in CPT that will be like publish meta box and contain some html code? See the attached shot for more info. enter image description here

0

The key function and search key word is add_meta_box(). This function add additional meta boxes to a post type, also custom post type.

See the codex for more about the parameters and also examples. You find also a lot of examples, how tos in the WWW and here on WPSE.

A simple example to understand it better, but without callback function myplugin_meta_box_callback, there handle your html, doing inside the meta box.

add_action( 'add_meta_boxes', 'myplugin_add_meta_box' );
/**
 * Adds a box to the main column on the Post and Page edit screens.
 */
function myplugin_add_meta_box() {

    $screens = array( 'custom_post_type', 'page' );

    foreach ( $screens as $screen ) {

        add_meta_box(
            'myplugin_section_id',
            __( 'My Meta Box Title', 'myplugin_textdomain' ),
            'myplugin_meta_box_callback',
            $screen
        );
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.