Created
February 29, 2020 08:12
-
-
Save wpbean/8bcbda36006601122e9bf99e19b96024 to your computer and use it in GitHub Desktop.
LearnPress add custom tabs to courses
This file contains 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 | |
/** | |
* Add Custom Tab | |
* Add this code to your theme or child theme functions.php file | |
*/ | |
add_filter( 'learn-press/course-tabs', 'wp_education_course_tab_customize' ); | |
function wp_education_course_tab_customize( $tabs ){ | |
$tabs['custom_tab'] = array( | |
'title' => __( 'Custom Tab', 'wp-education' ), | |
'priority' => 50, | |
'callback' => 'wp_educationlearn_press_custom_tab_content' | |
); | |
return $tabs; | |
} | |
// Custom Tab content | |
if( !function_exists('wp_educationlearn_press_custom_tab_content') ){ | |
function wp_educationlearn_press_custom_tab_content(){ | |
?> | |
<h3>Customm tab title</h3> | |
<p>Lorem ipsome text here.</p> | |
<?php | |
} | |
} |
As beucherm, it was not working for me at first.
I'm using "eduma" theme and this theme also hook this filter with priority 9999 !
You have to change priority as follow to make it works :
add_filter( 'learn-press/course-tabs', 'wp_education_course_tab_customize', 10000 );
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have try to add this on functions.php ( of the theme eduma) and no tab have been added on course page :-/