Skip to content

Instantly share code, notes, and snippets.

@wpbean
Created February 29, 2020 08:12
Show Gist options
  • Save wpbean/8bcbda36006601122e9bf99e19b96024 to your computer and use it in GitHub Desktop.
Save wpbean/8bcbda36006601122e9bf99e19b96024 to your computer and use it in GitHub Desktop.
LearnPress add custom tabs to courses
<?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
}
}
@beucherm
Copy link

I have try to add this on functions.php ( of the theme eduma) and no tab have been added on course page :-/

@JoKolov
Copy link

JoKolov commented Mar 4, 2021

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