How to upload a video using ACF in WordPress?

I am still at learning phase in WordPress. I cannot figure out in ACF which field type should I choose to upload a video file and which code should I write to show it at the front-end. Please look into the below code. I am using the_field('') but it isn't working. Can anyone help

                <video width="954" height="535" controls class="tm-mb-40">

                    <source src="video/wheat-field.mp4" type="video/mp4">   
                      
                    Your browser does not support the video tag.

                </video>

2 answers

  • answered 2022-05-07 07:46 Cristiano Reigns

    I think choose file under the file type in ACF and Upload it. After that use the_field there in your above written code.

    <video width="954" height="535" controls class="tm-mb-40">
      <?php the_field('video');?>
    
       </video>
    

  • answered 2022-05-07 11:54 Sanket Thakkar

    You can use ACF Type Link in the backend to attach video link like these

        <?php 
        
        $link_data = get_field('video_link'); 
        
        if(!empty($link_data))
        { 
        $link = $link_data['url'];  
        
        ?>
        
        <video width="954" height="535" controls class="tm-mb-40">
          
            <source src="<?php echo $link; ?>" type="video/mp4">   
                              
            Your browser does not support the video tag.
        
        </video>
    
    <?php } ?>
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum