Hi David,
1. I created a custom shortcode:
function my_hero_vid_shortcode() {
ob_start();
get_template_part( 'assets/php/parts/hero', 'video' );
return ob_get_clean();
}
add_shortcode( 'hero_video', 'my_hero_vid_shortcode' );
2. I added a template part file to the shortcode with the required acf fields:
<video autoplay playsinline muted loop preload="auto" poster="<?php the_field( 'opt_video_image', 'option' ); ?>" class="hero-video">
<source src="<?php the_field( 'opt_video_file', 'option' ); ?>" type="video/mp4">
</video>
3. I added the custom shortcode to the header element:
[hero_video]