Skip Navigation

[Resolved] How Do I Display Custom Field Values for Individual Video Embeds on My Posts

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

Problem:

I have created two custom fields that I'd like to display underneath each videopress video on my site (these videos are loaded into the media library). I have created the custom fields within Toolset and am capturing values for them for each video in the media library. How can I display these two values on screen, for video files only?

Solution:

There isn't such a built-in feature within Toolset shortcodes, since Types video field stores video URL, you can not get the related custom field "video size" value directly:

https://toolset.com/forums/topic/how-do-i-display-custom-field-values-for-individual-video-embeds-on-my-posts/#post-1186571

Relevant Documentation:

This support ticket is created 5 years, 10 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.

Our next available supporter will start replying to tickets in about 1.87 hours from now. Thank you for your understanding.

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 2 replies, has 2 voices.

Last updated by MichaelM5743 5 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1186533

Tell us what you are trying to do?

I have created two custom fields that I'd like to display underneath each videopress video on my site (these videos are loaded into the media library). I have created the custom fields within Toolset and am capturing values for them for each video in the media library. How can I display these two values on screen, for video files only?

Is there any documentation that you are following?

I've looked at various articles on your site and can't find an appropriate one.

Is there a similar example that we can see?

For example, I'd like to display the two values underneath the first two videos on this page:
hidden link

The two values in question are quite simple: one is a date and time value; the other is a simple numeric value.

What is the link to your site?

See above.

#1186571

Hello,

I assume we are talking about this case:
1) Post type "my-cpt"
- a custom video field "my-video"

2) And you have created some other custom fields to post type wordpress built-in post type "Media", for example
- custom field "video size"
...

And you are going to do this:
In a single "my-cpt" post, display the video field "my-video" value + "video size" field value

If it is, there isn't such a built-in feature within Toolset shortcodes, since Types video field stores video URL, you can not get the related custom field "video size" value directly, since it is stored in another post type "Media".

But it is possible with some custom codes, for example, you can try these:
1) create a shortcode, with a custom PHP function:
https://codex.wordpress.org/Function_Reference/add_shortcode

2) In this PHP function, get the video field URL value:
https://codex.wordpress.org/Function_Reference/get_post_meta
With above URL value, retrieve the media post ID:
For example:
hidden link

Then get other custom fields value by the media post ID

#1216493

My issue is resolved now. Thank you!