Created
March 19, 2020 13:10
-
-
Save wpbean/3caa91c2cf4feea984132ed76f2e8b0a to your computer and use it in GitHub Desktop.
Reptro Theme: Adding LearnPress profile custom tab for students
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Reptro LMS Theme: https://themeforest.net/item/reptro-online-course-wordpress-theme/21817850 | |
*/ | |
// Add this code on your child theme functions.php file | |
add_filter( 'learn-press/profile-tabs', 'reptro_learn_press_profile_tabs' ); | |
function reptro_learn_press_profile_tabs( $tabs ){ | |
if( function_exists('LP') ){ | |
$settings = LP()->settings; | |
$profile = LP_Profile::instance(); | |
$user = $profile->get_user(); | |
$role = $user->get_role(); | |
if( $role == 'user' ){ | |
$tabs['reptro_custom'] = array( | |
'title' => esc_html__( 'Custom Tab', 'reptro' ), | |
'slug' => $settings->get( 'profile_endpoints.profile-custom', 'custom' ), | |
'callback' => 'reptro_tab_custom', | |
'priority' => 50 | |
); | |
} | |
} | |
return $tabs; | |
} | |
function reptro_tab_custom(){ | |
?> | |
<h3>Custom Tab</h3> | |
<p>Add your content here.</p> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i need to change profile tab names and to add new profile tab in lms website of learpress how can i do that