Get total episode duration in PHP templates

Hey there,

according to the documentation, it should be possible to retrieve the total duration of an episode this way in a PHP template:

$episode = \Podlove\get_episode();
$episode->duration()->totalMilliseconds();

For some reason, this doesn’t do the job in my case. It works fine with hours(), minutes(), seconds(), and milliseconds(). It just won’t return nothing for totalMilliseconds().

Is it me or is this a bug?

Thanks for your help!
Nicolas

It’s a bug, and it applies to Twig templates as well.

Will be fixed in next release https://github.com/podlove/podlove-publisher/commit/02c8b8f7811eaf801474d535b7f1add7583c5334

1 Like

Hey Eric,

this still isn’t fixed in the current release, is it? If I get it right it will be part of 2.4.0. Would it also be possible to already include the changes in 2.3.13?

Thank you!
Nicolas

I feel like there won’t be a 2.3.13 (100% speculation). I think 2.4 is the next version we’ll see.

@Joey Probably. I will only release 2.3.13 if any critical (security/WordPress update compatibility) issues appear before 2.4.

@nicolasschabram feel free to apply the change to the file on your system until then :slight_smile:

Changed my mind: 2.3.13 was just released and includes the fix for this issue.

Great, thank you! :slight_smile: