We wanted to share some code with you that we created to show content if a WordPress Custom Meta / Field exists within a WordPress Custom Post Type. Most versions that we've encountered make this a bit cumbersome and we wanted a way to do it with php, but also to include full html within each command. Here's the snippet:-

A Practical Application Show a Vimeo Video (with embed code) with WordPress Custom Meta

In our application we wanted to show a Vimeo Video of a set size based on the Custom Meta ('ecpt_cpc_video_1' - substitute your own 'custom_meta') within a Custom Post Type - the Custom Meta in our case was the Vimeo Video ID. Here is the raw code:-

Assumptions

This will only work if you are within the WordPress Loop.