2 Ways To Get & Display YouTube Thumbnail Images by Video I.D

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.

Included are:

1. A page template which displays a grid of YouTube thumbnails like this:

youtube-thumbnail

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:

after-post

Once you install the code or the theme, you simply need to:

  1. Grab the YouTube video I.D from each YouTube video URL.
  2. Click Add Custom Field on each Edit post screen
  3. Enter youtube as the Name and the ID as the value like you see in the following image:

youtube-custom-field

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.

Related Code Snippets

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.