Hello,
I want to display Course Duration & Number of Units on home page under course box, so what field or code i need to call for displaying those values as its displayed on single course page.
hi,
I want to display Course Duration share the screenshot like exactly you want to show it
Number of Units on home page share both the screenshot where you want to show it and the screenshot
for presently where is the number of units are showing just for the reference
This reply has been marked as private.
hi,
need to check the code
if there is any hook then this can be done via shortcode
please ping me for the same
There is no hook created by us... Its in the WPLMS Code... i need either the shortcode or hook through which it can be done... couldn't find any code or variable thats being used to show on Single Course Display page so that we can call on home page as well... If you need ftp or wp-admin access then let me know...
to get course duration use : get_the_course_time('course_id='.$course_id)
to get number of unit use :
https://gist.github.com/alexvibealex/a009da03ca953c92af25e3ee72f43360
Hello @prateekgupta2009
There is no other way to show these details together.
Thank you
I was able to show number of units, but for course duration i want total duration of course in hours like length of all unit 3.5 hours, 4 hours etc... not the course duration access.
I am able to show time using below mentioned function, but its showing time in second. How to show time in decimal format like 3.5 or 4.2 Hours etc.. I want to show only 1 decimal value
//function to show course time
function wplms_show_unit_time($course_id){
$course_id = get_the_ID();
$course_curriculum = bp_course_get_curriculum($course_id);
$units=bp_course_get_curriculum_units($course_id);
$duration = $total_duration = 0;
foreach($units as $unit){
$duration = get_post_meta($unit,'vibe_duration',true);
if(get_post_type($unit)=='unit'){
$unit_duration_parameter = apply_filters('vibe_unit_duration_parameter',60,$unit);
}elseif(get_post_type($unit)=='quiz'){
$unit_duration_parameter = apply_filters('vibe_quiz_duration_parameter',60,$unit);
}
$total_duration = $total_duration + $duration*$unit_duration_parameter;
}
return $total_duration;
}
well to get in hours simply change the last line :
return $total_duration/(60*60);
AnonymousInactive
Dear prateekgupta2009,
thanks for confirming. closing this topic.