Dynamic Source for Video Element in Bricks Using Meta Box Post Field

This Pro tutorial provides the steps to set the source of a Bricks video element on single CPT pages to be the URL of a video that has been linked to the current CPT item using Meta Box's Post custom field.

Scenario:

CPT 1: service with a video custom field of type "Post" with the Post type set to video (Multiple is not checked).

CPT 2: video with a video_embed custom field of type "oEmbed".

Sample Video CPT item:

Sample Service CPT item

On the front end:

Step 1

Let's define a custom function that gets the URL of the oEmbed video of the video post whose ID is the value of the current post's video field.

Add the following in child theme's functions.php or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Instant access to 390+ Bricks code tutorials with BricksLabs Pro