$prefix . 'upstudy_ld_course_metabox', 'title' => __('Course Options', 'upstudy'), 'object_types' => array('sfwd-courses', 'groups'), // Post type 'context' => 'normal', 'priority' => 'high', 'show_names' => true, // Show field names on the left )); $cmb_ld_course_metabox->add_field(array( 'name' => 'Add Intro Video URL', 'id' => 'upstudy_ld_video', 'type' => 'oembed', 'description' => __( 'It will not work if you add video in the option Settings -> Video URL or Embed Code', 'upstudy' ) )); $cmb_ld_course_metabox->add_field( array( 'name' => __( 'Header Image', 'upstudy' ), 'id' => $prefix . 'header_img', 'type' => 'file', 'options' => array( 'url' => false ), 'text' => array( 'add_upload_file_text' => __( 'Add Image', 'upstudy' ) ), 'description' => __( 'This image will be shown at the course single page header section.', 'upstudy' ) ) ); $cmb_ld_course_metabox->add_field(array( 'name' => __('Excerpt', 'upstudy'), 'desc' => __('Add course short description', 'upstudy'), 'id' => $prefix . 'ld_excerpt', 'type' => 'textarea_small', )); $cmb_ld_course_metabox->add_field( array( 'name' => 'Course Levels', 'id' => 'upstudy_ld_course_level_key', 'type' => 'radio', 'default' => 'all_levels', // 'show_option_none' => true, 'options' => array( 'all_levels' => __( 'All Levels', 'upstudy' ), 'beginner' => __( 'Beginner', 'upstudy' ), 'intermediate' => __( 'Intermediate', 'upstudy' ), 'expert' => __( 'Expert', 'upstudy' ), ), ) ); } // ========= LearnDash course custom features metxbox ======== add_action('cmb2_admin_init', 'tpc_upstudy_ld_course_feature_metaboxes'); function tpc_upstudy_ld_course_feature_metaboxes() { $prefix = '_upstudy_'; $cmb_ld_course_metabox = new_cmb2_box(array( 'id' => 'upstudy_ld_course_feature_repeater', 'title' => 'Custom Course Features', 'object_types' => array('sfwd-courses', 'groups'), // Post type 'context' => 'normal', 'priority' => 'high', 'show_names' => true, // Show field names on the left )); $cmb_ld_course_metabox->add_field( array( 'id' => $prefix . 'ld_certificate_show', 'name' => 'Certificate?', 'type' => 'radio_inline', 'default' => 'no', 'options' => array( 'yes' => __( 'Yes', 'upstudy' ), 'no' => __( 'No', 'upstudy' ), ), ) ); $ld_custom_feature_group_id = $cmb_ld_course_metabox->add_field(array( 'id' => 'ld_custom_feature_group', 'type' => 'group', 'repeatable' => true, 'options' => array( 'group_title' => 'Course Features {#}', 'add_button' => 'Add Another Feature', 'remove_button' => 'Remove Feature', 'closed' => true, // Repeater fields closed by default - neat & compact. 'sortable' => true, // Allow changing the order of repeated groups. ), )); $cmb_ld_course_metabox->add_group_field($ld_custom_feature_group_id, array( 'name' => __('Add Icon', 'upstudy'), 'desc' => __('Here you can add icon classes such as Dashicon, Elementor, etc. Learn more about the icons class. go here', 'upstudy'), 'id' => 'ld_custom_feature_group_icon', 'type' => 'text', // This field type )); $cmb_ld_course_metabox->add_group_field($ld_custom_feature_group_id, array( 'name' => __('Label', 'upstudy'), 'desc' => __('Add your custom course feature label', 'upstudy'), 'id' => 'ld_custom_feature_group_label', 'type' => 'text', )); $cmb_ld_course_metabox->add_group_field($ld_custom_feature_group_id, array( 'name' => __('Value', 'upstudy'), 'desc' => __('Add your custom course feature label value', 'upstudy'), 'id' => 'ld_custom_feature_group_value', 'type' => 'text', )); }