Show different Course description in WPLMS Student App

Sometimes, your course page is built with elementor or visual composer , in those cases the description appears as garbage in the app as visual composer or elementor scripts are not loaded in the app.

This code fix, enables users to add a different course description for the App.

There are 2 parts :

  1. Adds a custom meta field in the Course as ” App Description”.
  2. Modify api to server course content from App description field.

 

Add following code in the Child Theme – functions.php

 

add_filter(‘wplms_course_metabox’,function($args){
$args[‘vibe_app_course_description’]=array( // Text Input
‘label’ => __(‘App Course description’,’vibe-customtypes’), // <label>
‘desc’ => __(‘This descrption is shown in App as course description’), // description
‘id’ => ‘vibe_app_course_description’, // field id and name
‘type’ => ‘editor’, // type of field
‘std’ => __(‘This message is shown as course description in app’,’vibe-customtypes’)
);
return $args;
});

 

add_filter(‘bp_course_api_get_course’,function($data,$request){

if($request[‘context’] == ‘full || $request[‘context’] == ‘loggedin’){
$data[‘description’] = do_shortcode(get_post_meta( $request[‘id’],’vibe_app_course_description’,true));
}
return $data;
},10,2);

Leave a Reply

Your email address will not be published. Required fields are marked *