HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux srv1.dlabib.net 6.8.0-94-generic #96-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 9 20:36:55 UTC 2026 x86_64
User: hbkconsultan_usr (1002)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /var/www/hbkconsultan_usr/data/www/hbkconsultancy.com/wp-content/themes/edubin/inc/cmb2/tutor.php
<?php

// Edubin tutor course features metabox
add_action('cmb2_admin_init', 'edubin_tutor_course_video');
function edubin_tutor_course_video()
{
    $prefix                = '_edubin_';
    $cmb_tutor_course_metabox = new_cmb2_box(array(
        'id'           => $prefix . 'edubin_tutor_course_video_metabox',
        'title'        => __('Course Intro Video', 'edubin-core'),
        'object_types' => array('courses'), // Post type
        'context'      => 'normal', //  'normal', 'advanced', or 'side'
        'priority'     => 'core', //  'high', 'core', 'default' or 'low'
        'show_names'   => true, // Show field names on the left
    ));
    // $cmb_tutor_course_metabox->add_field(array(
    //     'name' => 'Add Intro Video URL',
    //     'id'   => 'edubin_tutor_video',
    //     'type' => 'oembed',
    // ));
    $cmb_tutor_course_metabox->add_field( array(
        'name'    => __( 'Header Image', 'edubin' ),
        'id'      => $prefix . 'header_img',
        'type'    => 'file',
        'options' => array(
            'url' => false
        ),
        'text'    => array(
            'add_upload_file_text' => __( 'Add Image', 'edubin' )
        ),
        'description'  => __( 'This image will be shown at the course single page header section.', 'edubin' )
    ) );
}

// ========= Tutor course custom features metxbox ========
add_action('cmb2_admin_init', 'edubin_tutor_course_feature_metaboxes');
function edubin_tutor_course_feature_metaboxes()
{
    $prefix                = '_edubin_';
    
    $cmb = new_cmb2_box(array(
        'id'           => 'edubin_tutor_course_feature_repeater', 
        'title'        => 'Custom Course Features',
        'object_types' => array('courses'), // Post type
        'context'      => 'normal',
        'priority'     => 'high',
        'show_names'   => true, // Show field names on the left
    ));

    $tutor_custom_feature_group_id = $cmb->add_field(array(
        'id'         => 'tutor_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->add_group_field($tutor_custom_feature_group_id, array(
        'name' => __('Add Icon', 'edubin-core'),
        'desc' => __('Here you can add icon classes such as Dashicon, Elementor, etc. Learn more about the icons class. <a target="_blank" href="https://thepixelcurve.com/support/docs/edubin/#icons">go here</a>', 'edubin-core'),
        'id'   => 'tutor_custom_feature_group_icon',
        'type' => 'text', // This field type
    ));
    $cmb->add_group_field($tutor_custom_feature_group_id, array(
        'name' => __('Label', 'edubin-core'),
        'desc' => __('Add your custom course feature label', 'edubin-core'),
        'id'   => 'tutor_custom_feature_group_label',
        'type' => 'text',
    ));
    $cmb->add_group_field($tutor_custom_feature_group_id, array(
        'name' => __('Value', 'edubin-core'),
        'desc' => __('Add your custom course feature label value', 'edubin-core'),
        'id'   => 'tutor_custom_feature_group_value',
        'type' => 'text',
    ));
}