Skip Navigation

[Resolved] How to get video meta data and display length

This thread is resolved. Here is a description of the problem and solution.

Problem:

I have a custom post type named "Videos" with only a single video input field for uploading video to the media library. On the archive page where all videos are being displayed I would like to display the video length on each video.

Solution:

There isn't such a built-in feature within Toolset plugins, you might consider custom codes, for example setup a custom shortcode for it.

Relevant Documentation:

https://developer.wordpress.org/reference/functions/add_shortcode/

This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 3 voices.

Last updated by PaulC9812 6 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1111273

I have a custom post type named "Videos" with only a single video input field for uploading video to the media library. On the archive page where all videos are being displayed I would like to display the video length on each video.
---
How can I implement the:

wp_read_video_metadata( string $file )

found here on codex: https://developer.wordpress.org/reference/functions/wp_read_video_metadata/

To display the video length inside the loop generator?

#1111364

Hello,

There isn't such a built-in feature within Toolset plugins, for the custom video field, see our document:
https://toolset.com/documentation/customizing-sites-using-php/functions/#video

There isn't such an option to get the "video meta data and display length", if you agree, we can take it as a feature request.

Currently, you might consider custom codes, for example setup a custom shortcode for it:
https://developer.wordpress.org/reference/functions/add_shortcode/

#1113824

Can you show the provide the php for the shortcode that would make this possible. After lot's of research I did see another non related issue that also suggested the user to create a custom shortode in the functions.php file then use that inside the template code for one of the toolset templates. I don't know php well enough to knock something like that out.

It would be a huge help if you could provide a basic shortcode sample that would get the video length.

Thanks Luo

#1114124

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Luo has a day off today. He will get back tomorrow and reply you here.

As far as I can see it needs custom programming which is beyond the scope of our support policy.

If you need custom programming for your project, please feel free to contact our certified partners:
=> https://toolset.com/contractors/

#1114129

My issue is resolved now. Thank you!