Skip to content

Instantly share code, notes, and snippets.

@wpbean
Last active May 12, 2020 12:19
Show Gist options
  • Select an option

  • Save wpbean/a3f57a78a2af8454fbad0a0a1c0d22a3 to your computer and use it in GitHub Desktop.

Select an option

Save wpbean/a3f57a78a2af8454fbad0a0a1c0d22a3 to your computer and use it in GitHub Desktop.
Reptro theme add custom dynamic tabs to the LearnPress
<?php
/**
* Add Custom Tab
*/
add_filter( 'reptro_course_options', 'reptro_course_options_custom_fields' );
function reptro_course_options_custom_fields( $fields ){
$fields[] = array(
'id' => 'custom_tab_one',
'type' => 'wysiwyg',
'title' => esc_html__( 'Custom Tab One', 'bright-cpt-shortcode' ),
'default' => '',
'settings' => array(
'textarea_rows' => 5,
'tinymce' => false,
'media_buttons' => false,
)
);
$fields[] = array(
'id' => 'custom_tab_two',
'type' => 'wysiwyg',
'title' => esc_html__( 'Custom Tab Two', 'bright-cpt-shortcode' ),
'default' => '',
'settings' => array(
'textarea_rows' => 5,
'tinymce' => false,
'media_buttons' => false,
)
);
return $fields;
}
add_filter( 'learn-press/course-tabs', 'reptro_course_tab_customization' );
function reptro_course_tab_customization( $tabs ){
$tabs['custom_tab_one'] = array(
'title' => __( 'Custom Tab', 'reptro' ),
'priority' => 50,
'callback' => 'reptro_custom_tab_content_one'
);
$tabs['custom_tab_two'] = array(
'title' => __( 'Custom Tab 2', 'reptro' ),
'priority' => 50,
'callback' => 'reptro_custom_tab_content_two'
);
return $tabs;
}
// Custom Tab content
function reptro_custom_tab_content_one(){
echo reptro_get_post_meta( '_course_side_options', 'custom_tab_one', '', true );
}
function reptro_custom_tab_content_two(){
echo reptro_get_post_meta( '_course_side_options', 'custom_tab_two', '', true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment