In a recent site I worked on, my task was to display values of custom fields attached to a CPT. One of these custom fields is a URL field named “YouTube Video” added via Types plugin. I tried a couple of free plugins from the WP repository including WP YouTube Player that would display YouTube video by wrapping the URL in shortcodes. Unfortunately they did not work when the URL value is a shortcode inserted via Views. What worked was iThemes VidEmbed plugin.
Here is the code to display YouTube video with player when the video URL has been entered in a custom field attached to a CPT in WordPress.
where youtube-link is the name of URL field in which YouTube URL (Ex.: https://www.youtube.com/watch?v=m0iiTk3MQ3k) will be entered. In the above width and height values can of course be adjusted. Also the field name should be changed.
With this View Template (per the screenshot at the top of this post) set as the field to display in grid layout for the CPT listing via a View (screenshot), here’s the output:
Hi Sridhar, I really enjoy your Tutorials. I was wondering if you can make a tutorial of how you created the video gallery above from start to finish.
Thanks
Tino
I purchased this plugin, but I still can’t make it work right.. can you help me a little bit? I would really appreciate it!!
THANK YOU!
Can you provide the URL of your site? What are you trying to do?