Sometimes you may want to add some information regarding a course in the Course details section.
Here's how you can add your custom data in Course details section.
Note : There are now multiple ways to achieve this.
METHOD 1 (Recommended)
0. Install the WPLMS Customizer plugin
1. Go to following location : Wp admin -> Plugins -> editor -> wplms customizer -> customizer_class.php
2. Add the following line in the _construct function:
add_filter('wplms_course_details_widget',array($this,'custom_wplms_course_details_widget'));
3. Now add the following function in the class:
function custom_wplms_course_details_widget($course_details){ $course_details['custom']='<li><i class="icon-plus-1"></i> This is my custom detail</li>'; return $course_details; }
Optional : Insert the above line in between the Course details, use below function instead of above
3. Now add the following function in the class:
function custom_wplms_course_details_widget($course_details){ foreach($course_details as $key => $value){ $new_course_details[$key] = $value; if($key == 'price'){ //keys value $new_course_details['custom']='<li><i class="icon-plus-1"></i> This is my custom detail</li>'; } } return $new_course_details; }
To insert after price use price instead of time, possible key values : price, precourse,time, badge,certificate
================================================== ======================================
METHOD 2
0. Install the WPLMS Customizer plugin
1. Go to following location : Wp admin -> Plugins -> editor -> wplms customizer -> customizer_class.php
2. Add the following line in the _construct function:
add_filter('wplms_course_front_details',array($this,'wplms_course_front_details'));
3. Now add the following function in the class:
function wplms_course_front_details($course_details){ $course_details .= '<ul><li><i class="icon-plus-1"></i> This is my custom detail</li></ul>'; return $course_details; }
******************************************
You can further extend this tip by making use of Custom Fields in WordPRess.
You can enable custom fields from the Screen options when you're editing a course.
1. Add a new custom field, example : myfield and enter a value example: 8 Lessons
2. Now modify the above function :
function wplms_course_front_details($course_details){ $id=get_the_id(); $lessons=get_post_meta($id,'myfield',true); if(isset($lessons) && $lessons){ $course_details .= '<ul><li>'.$lessons.'</li></ul>'; } return $course_details; }