Adding Custom Section in Course menu

NOTE: This tip works only for less than  wplms 2.0 versions only.

1. Go to WP Admin -> Plugins -> Editor -> WPLMS Customizer -> Customizer_class.php

2. Add following lines in _construct function:

PHP Code:
add_filter('wplms_course_nav_menu',array($this,'wplms_course_custom_nav_menu_item'));    
add_filter('wplms_course_locate_template',array($this,'wplms_course_nav_custom_section'),10,2);  
add_action('wplms_load_templates',array($this,'wplms_course_custom_section_area')); 

3. Add following functions in Class:

PHP Code:

function wplms_course_custom_nav_menu_item($course_menu){
      $link = bp_get_course_permalink();
      $course_menu['custom']=array(
                                    'id' => 'custom',
                                    'label'=>__('Custom Item','vibe'),
                                    'action' => 'custom',
                                    'link'=> $link,
                                );
    return $course_menu;
}
function wplms_course_nav_custom_section($template,$action){
      if($action == 'custom'){ 
          $template= array(get_template_directory('course/single/plugins.php'));
      }
      return $template;
}
function wplms_course_custom_section_area(){
    if(!isset($_GET['action']) || ($_GET['action'] != 'custom') )
    return;
 
    echo '<h3 class="heading">'.__('Custom Nav Section','vibe').'</h3>';
}

Alternate :

Copy and paste this code in WPLMS  Child theme functions.php file or WPLMS Customizer plugin – wplms_customizer.php

add_filter('wplms_course_nav_menu','wplms_course_custom_nav_menu_item');    
add_filter('wplms_course_locate_template','wplms_course_nav_custom_section',10,2);  
add_action('wplms_load_templates','wplms_course_custom_section_area');
 
function wplms_course_custom_nav_menu_item($course_menu){
      $link = bp_get_course_permalink();
      $course_menu['custom']=array(
                                    'id' => 'custom',
                                    'label'=>__('Custom Item','vibe'),
                                    'action' => 'custom',
                                    'link'=> $link,
                                );
    return $course_menu;
}
function wplms_course_nav_custom_section($template,$action){
      if($action == 'custom'){ 
          $template= array(get_template_directory('course/single/plugins.php'));
      }
      return $template;
}
function wplms_course_custom_section_area(){
    if(!isset($_GET['action']) || ($_GET['action'] != 'custom') )
    return;
 
    echo '<h3 class="heading">'.__('Custom Nav Section','vibe').'</h3>';
}

Result :

 

Was this article helpful?

Related Articles