I am trying to load a full width video on my homepage. My situation is almost exactly like:
Video Background – (php & css) – generating 404 error on page load – WordPress Theme File Structure Help

However, I do have the path to my video set as:

<source src="https://wordpress.stackexchange.com/wp-content/themes/uf2016/assets/videos/videobg.mp4" type="video/mp4">

This is a stuck I have been on for a while and have tried various ways to call in the video but all result in a 404. What am I missing that is causing wordpress to not see this file?

Console output error

enter image description here

Console output error when using get_template_directory_uri()

enter image description here

3 Answers
3

Using get_template_directory_uri() or get_stylesheet_directory_uri() you can retrieve the url to your themes folder, and after that you just need to specify the path starting from there. Your code should look like this:

<source src="https://wordpress.stackexchange.com/questions/256580/<?php echo get_template_directory_uri() ."/assets/videos/videobg.mp4'; ?>" type="video/mp4">

Leave a Reply

Your email address will not be published. Required fields are marked *