88 lines
3.5 KiB
PHP
88 lines
3.5 KiB
PHP
<?php
|
|
|
|
//Upstudy course features metabox
|
|
add_action('cmb2_admin_init', 'tpc_upstudy_lif_course_features_metabox');
|
|
function tpc_upstudy_lif_course_features_metabox()
|
|
{
|
|
$prefix = '_upstudy_';
|
|
$cmb_lif_course_metabox = new_cmb2_box(array(
|
|
'id' => $prefix . 'upstudy_lif_course_metabox',
|
|
'title' => __('<span>Course Options</span>', 'upstudy'),
|
|
'object_types' => array('course'), // Post type
|
|
'context' => 'normal',
|
|
'priority' => 'high',
|
|
'show_names' => true, // Show field names on the left
|
|
));
|
|
$cmb_lif_course_metabox->add_field(array(
|
|
'name' => 'Add Intro Video URL',
|
|
'id' => 'upstudy_lif_video',
|
|
'type' => 'oembed',
|
|
));
|
|
|
|
$cmb_lif_course_metabox->add_field(array(
|
|
'name' => __('Excerpt', 'upstudy'),
|
|
'desc' => __('Add course short description', 'upstudy'),
|
|
'id' => $prefix . 'lif_excerpt',
|
|
'type' => 'textarea_small',
|
|
));
|
|
|
|
}
|
|
|
|
// ========= LearnDash course custom features metxbox ========
|
|
|
|
add_action('cmb2_admin_init', 'tpc_upstudy_lif_course_feature_metaboxes');
|
|
function tpc_upstudy_lif_course_feature_metaboxes()
|
|
{
|
|
$prefix = '_upstudy_';
|
|
|
|
$cmb_lif_course_metabox = new_cmb2_box(array(
|
|
'id' => 'upstudy_lif_course_feature_repeater',
|
|
'title' => 'Custom Course Features',
|
|
'object_types' => array('course'), // Post type
|
|
'context' => 'normal',
|
|
'priority' => 'low',
|
|
'show_names' => true, // Show field names on the left
|
|
));
|
|
|
|
$cmb_lif_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' ),
|
|
),
|
|
) );
|
|
$lif_custom_feature_group_id = $cmb_lif_course_metabox->add_field(array(
|
|
'id' => 'lif_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_lif_course_metabox->add_group_field($lif_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. <a target="_blank" href="https://devthrow.com/support/docs/upstudy/#icons">go here</a>', 'upstudy'),
|
|
'id' => 'lif_custom_feature_group_icon',
|
|
'type' => 'text', // This field type
|
|
));
|
|
$cmb_lif_course_metabox->add_group_field($lif_custom_feature_group_id, array(
|
|
'name' => __('Label', 'upstudy'),
|
|
'desc' => __('Add your custom course feature label', 'upstudy'),
|
|
'id' => 'lif_custom_feature_group_label',
|
|
'type' => 'text',
|
|
));
|
|
$cmb_lif_course_metabox->add_group_field($lif_custom_feature_group_id, array(
|
|
'name' => __('Value', 'upstudy'),
|
|
'desc' => __('Add your custom course feature label value', 'upstudy'),
|
|
'id' => 'lif_custom_feature_group_value',
|
|
'type' => 'text',
|
|
));
|
|
}
|