Example #1
0
/**
 * Output a metabox
 * @since 1.0.0
 * @param array $meta_box  Metabox config array
 * @param int   $object_id Object ID
 */
function cmb_print_metabox($meta_box, $object_id)
{
    $cmb = new cmb_Meta_Box($meta_box);
    if ($cmb) {
        cmb_Meta_Box::set_object_id($object_id);
        if (!wp_script_is('cmb-scripts', 'registered')) {
            $cmb->register_scripts();
        }
        wp_enqueue_script('cmb-scripts');
        // default is to show cmb styles
        if ($meta_box['cmb_styles'] != false) {
            wp_enqueue_style('cmb-styles');
        }
        cmb_Meta_Box::show_form($meta_box);
    }
}