CoursePress Pro view unit time in hours not minutes


The units which I am creating in Courspress are rather long. I wonder if it's possible to choose "hours" instead of "minutes" to display the time?

Perhaps you could do something like, if the total minutes is greater than 90 (1.5 hours) display the unites in hours instead?

Or, perhaps simply an option to choose to display time in minutes or hours in the course description



  • Predrag Dubajic
    • Support

    Hey Ben,

    Hope you're doing well today :slight_smile:

    I had a look at the code here and I believe it would be only possible to do this by modifying plugin files a bit.
    I will move this thread in Features & Feedback section so we can consider adding the option in future and will ping our second level support dev guys to see what would be best way to do this now.
    Please note that, developer response might be slower than usual staff response, so we appreciate your patience on this.

    Best regards,

  • Sajid
    • DEV MAN’s Sidekick

    Hi @Benjamin

    Hope you are doing good today :slight_smile:

    Try adding following code in functions.php file of your child theme or use mu-plugin.

    add_filter( 'coursepress_unit_time_estimation_minutes_and_seconds_format', 'cp_convert_minutes_to_hours', 10, 2 );
    function cp_convert_minutes_to_hours( $time ) {
        $get_minutes = explode(":", $time);
        if($get_minutes[0] < 90) return $time;
        $hours = round( ( $get_minutes[0] / 60 ) , 2) ;
        return $hours. ' hours';

    Let me know how it goes :slight_smile:

    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.