This tutorial provides both the code and the code installed in the Genesis Sample child theme.
The code provides 2 ways to display YouTube video images in Genesis and will work in any theme with some basic modification.
1. A page template which displays a grid of YouTube thumbnails like this:
2. And the Genesis Sample theme also includes code which enables you to hook in the images anywhere in your theme. In this example, its after single posts:
Once you install the code or the theme, you simply need to:
- Grab the YouTube video I.D from each YouTube video URL.
- Click Add Custom Field on each Edit post screen
- Enter youtube as the Name and the ID as the value like you see in the following image:
Save the post after adding the custom field and you’re done.
1. The Page Template Code
Using a code editor, create a new file named page_youtube.php and add the following PHP code to the file which you can then upload to your child themes root directory.