Skip to content

EP YouTube

EP YouTube embeds YouTube videos on your PageMotor site without the privacy and performance costs of a plain <iframe>. The visitor sees a lightweight thumbnail. YouTube only loads when they click play.

Published by ElmsPark Studio.

PageMotor’s built-in oEmbed renders a YouTube <iframe> immediately when the page loads. That:

  • Drops YouTube cookies in the visitor’s browser before they’ve decided to watch anything.
  • Ships ~600KB of YouTube player JavaScript per video on the page.
  • Tanks Lighthouse scores on any page with more than one video.
  • Pings i.ytimg.com (a Google CDN) for the player poster image.

EP YouTube replaces all of that with a thumbnail placeholder. The heavy iframe is only built when the visitor clicks play, and on that click the iframe loads from youtube-nocookie.com so YouTube does not store tracking cookies unless the visitor actually interacts with the player.

Optional: enable Self-Host Thumbnails to download each video’s thumbnail to your own server on first pageview. After that, no request to Google ever happens until the visitor clicks play.

  • PageMotor 0.7 or later
  • EP Suite base class (bundled)
  1. Download ep-youtube.zip from the EP Suite downloads page.
  2. Upload via Plugins → Manage Plugins. Activate.
  3. Open Plugin Settings → EP YouTube.
  4. Defaults are sensible. No-Cookie Mode is on, default aspect ratio is 16:9, default thumbnail resolution is Standard. Most sites need nothing else.
  5. Insert your first video by adding [youtube id="dQw4w9WgXcQ"] to any page or post.

The shortcode accepts a bare YouTube ID, a youtu.be/ link, a youtube.com/watch?v= URL, an /embed/ URL, or a /shorts/ URL — paste whichever you have.

[youtube id="dQw4w9WgXcQ"]
[youtube id="https://youtu.be/dQw4w9WgXcQ"]
[youtube id="https://www.youtube.com/watch?v=dQw4w9WgXcQ"]

All four forms produce the same output.

AttributeExampleEffect
titletitle="A Day on the Lake"Heading overlay on the thumbnail, gradient-down to clear, line-clamped to 2 lines. Matches YouTube’s idle-state title bar so the visitor has context before clicking play.
aspectaspect="4:3"Override the default aspect ratio. Accepts 16:9, 4:3, 1:1, 21:9, 9:16, or any WIDTH:HEIGHT.
thumbthumb="https://example.com/poster.jpg"Use your own thumbnail image instead of YouTube’s.
altalt="Demo of the new feature"Alt text for the thumbnail image.
paramsparams="start=30&end=120"Extra YouTube player parameters appended to the iframe URL. Use ampersand-separated key=value pairs.
classclass="extend"Extra CSS class on the .youtube container, for skin “break out” or other layout hooks.
wrapwrap="container"Wrap the video in an outer <div> with this class.
  • Default Aspect Ratio. Used when the shortcode does not specify an aspect attribute. 16:9 by default. The plugin supports 16:9, 4:3, 1:1, 21:9, and 9:16 (vertical / Shorts).
  • Default Thumbnail Resolution. YouTube serves thumbnails at three tiers. Standard (sddefault.jpg) is always available and works for every video. High Quality (hqdefault.jpg) is slightly sharper. Maximum (maxresdefault.jpg) is the sharpest but is missing for many older or custom-thumbnail videos — if your thumbnails go blank, drop back to Standard.
  • No-Cookie Mode (on by default). Loads the player iframe from youtube-nocookie.com instead of youtube.com. YouTube does not store tracking cookies after the visitor clicks play, unless they interact with the player itself. Recommended.
  • Self-Host Thumbnails (off by default). Downloads each video’s thumbnail to user-content/ep-youtube-thumbs/ on first pageview, so subsequent visitors only ever see your domain in their network tab until they click play. Adds about 10–50KB of storage per cached video. Best for sites where you want zero Google requests even on the idle pageview state.

The shortcode renders a <div class="youtube" data-embed="VIDEO_ID"> placeholder, plus a play-button arrow and optionally a title overlay. The plugin’s sitewide JavaScript paints a thumbnail into the placeholder (from YouTube’s CDN, your custom URL, or your self-hosted cache).

When the visitor clicks anywhere on the placeholder, the JS builds the YouTube iframe with autoplay=1, swaps it in for the placeholder contents, and the video starts playing immediately. One click — same as a default YouTube embed — but no cookies and no heavy assets until the click happens.

YouTube’s own iframe shows a title bar over the poster when the player is idle (before play). EP YouTube uses autoplay=1 on click, which skips that idle state, so YouTube’s title bar never appears. To restore the title context, use the title shortcode attribute:

[youtube id="qIQReeJoAWY" title="A Day on the Lake"]

This paints your own heading overlay on the thumbnail with the same gradient-down-to-clear styling YouTube uses, line-clamped to 2 lines so long titles don’t overrun. The overlay is removed when the iframe takes over.

If you’ve ported a Thesis/Focus site to PageMotor and the original Thesis YouTube Box markup is still in your content (<div class="youtube" data-embed="...">), EP YouTube’s frontend JavaScript picks those up and lazy-loads them too. No content rewrite required.

This is how a number of ElmsPark migrations have brought across YouTube videos from Thesis without touching the post HTML.

EP YouTube is GDPR-compliant on its own. The visitor’s click on the thumbnail is itself an act of explicit consent under GDPR, so no separate cookie-banner gate is required for the iframe.

If EP GDPR is also installed, the two plugins agree on the privacy story. The privacy policy generated by EP GDPR can mention the EP YouTube no-cookie default, and the site’s overall compliance dashboard reflects the embed setup.

YouTube doesn’t have a maxresdefault.jpg for every video — particularly older uploads or videos with non-default custom thumbnails. If you’ve set Default Thumbnail Resolution to Maximum, try dropping back to Standard. The JS also auto-falls-back from Max to Standard on image-load error.

“The video is playing but there’s no title shown”

Section titled ““The video is playing but there’s no title shown””

EP YouTube’s autoplay-on-click flow skips YouTube’s idle-state title overlay. Use the title shortcode attribute to paint your own heading over the thumbnail before click.

The params shortcode attribute is passed through to the iframe URL. To re-enable YouTube branding, pass params="modestbranding=0". To show related videos on the end screen, omit the default rel=0 — actually you can’t, but you can override with params if you have a specific need.

“How do I match my old <iframe> embeds for the visual diff?”

Section titled ““How do I match my old <iframe> embeds for the visual diff?””

Add the title attribute to match the heading overlay a vanilla YouTube iframe shows in its idle state. The poster image will be the same since both pull from i.ytimg.com. The difference: yours loads YouTube on every pageview, EP YouTube only loads it after the click.

The lazy-load mechanism is inspired by Chris Pearson’s Thesis YouTube Box (DIYthemes, GPL v3.0, 2019). EP YouTube is a clean-room PageMotor implementation with the same architecture plus two privacy upgrades: the youtube-nocookie.com iframe host by default, and the optional thumbnail self-hosting.

For a quick question about this plugin, EP Support inside your admin is the fastest option. The chat widget sits on every EP plugin settings page and knows which one you’re on, with starter questions and links preloaded for that exact screen.

For anything bigger — a bug report, a feature request, or a “how do I…” that needs a real reply — open a ticket at help.elmspark.com. A real person, helped by AI, writes the reply. Usually within a few hours. Tickets don’t disappear into the void.

  • Settings language menu. The language menu in this plugin’s settings now lists only the languages it is actually translated into, plus English, so you can no longer pick a language that changes nothing.
  • Danish. Adds a Danish translation.
  • Fixes a doubled cache-busting tag on its stylesheet. On PageMotor 0.11 and later the page asked for the file with two version tags on the end of its address (?v=…?v=…), because the core had started adding its own tag and the plugin was still adding one too. The file loaded correctly, so nothing was visibly broken; the address was just malformed and every cache saw a longer key than it needed. The plugin now leaves the tag to the core on 0.11 and later, and still adds its own on older cores, where nothing else would.
  • No change to what that stylesheet does.
  • Fixes videos showing a blank click-to-load box with no poster image. YouTube does not generate the standard-definition thumbnail for every upload, and the plugin used it as the default poster with no fallback, so those videos rendered an empty box with only the play button. The poster now steps down one tier at a time when YouTube has no image at that size (maximum, then standard, then high quality, which YouTube generates for every video). Box size and cropping are unchanged.
  • The Self-Host Thumbnails download uses the same fallback, so a video whose standard thumbnail is missing now caches locally instead of failing.
  • The front-end script is now cache-busted on PageMotor 0.11.2 and earlier, so this fix reaches visitors on their next page load rather than after their browser cache expires. On 0.11.3 and later core already does this.
  • The Default Thumbnail Resolution setting labels now say which tier is always available (High Quality) and which can be missing (Standard, Maximum). No settings change or migration required.
  • Fixes “Your session has expired. Please reload to ensure your security.” on PageMotor 0.11. The message appeared on this plugin’s admin screens even though you were signed in perfectly normally, and whatever you were doing failed to save.
  • Nothing was wrong with your session. PageMotor 0.11 started handling part of the security check that this plugin was already handling itself, and the two together made every save look invalid. The plugin now checks whether PageMotor has already done it.
  • Visitors who were not signed in were never affected, on any version.
  • There is nothing to reconfigure, and nothing else changed.