Skip to content

Instantly share code, notes, and snippets.

@wpbean
Created March 19, 2020 13:10
Show Gist options
  • Save wpbean/3caa91c2cf4feea984132ed76f2e8b0a to your computer and use it in GitHub Desktop.
Save wpbean/3caa91c2cf4feea984132ed76f2e8b0a to your computer and use it in GitHub Desktop.
Reptro Theme: Adding LearnPress profile custom tab for students
<?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
}
@deepikamishika
Copy link

i need to change profile tab names and to add new profile tab in lms website of learpress how can i do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment