Exemplo n.º 1
0
/**
 * Output a metabox
 * @since 1.0.0
 * @param array $meta_box  Metabox config array
 * @param int   $object_id Object ID
 */
function cpmb_print_metabox($meta_box, $object_id)
{
    $cpmb = new cpmb_Meta_Box($meta_box);
    if ($cpmb) {
        cpmb_Meta_Box::set_object_id($object_id);
        if (!wp_script_is('cpmb-scripts', 'registered')) {
            $cpmb->register_scripts();
        }
        wp_enqueue_script('cpmb-scripts');
        // default is to show cpmb styles
        if (!isset($meta_box['cpmb_styles']) || $meta_box['cpmb_styles'] != false) {
            wp_enqueue_style('cpmb-styles');
        }
        cpmb_Meta_Box::show_form($meta_box);
    }
}