=== Latest YouTube Embed Feed ===
Contributors: tudor
Tags: youtube, video, embed, feed, shortcode
Requires at least: 5.5
Tested up to: 6.5
Requires PHP: 7.2
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Auto-embed the latest video from any YouTube channel. Paste a channel and the
plugin builds the feed for you. Custom overlay, "old TV" frame, analogue
tune-in intro, and a repeater so each channel gets its own shortcode.

== Description ==

Latest YouTube Embed Feed keeps a page showing the newest upload from a YouTube
channel, without you touching it again. It reads YouTube's public RSS feed (no
API key) on a schedule you choose and plays the video through the YouTube
IFrame API inside a container you control — so you decide the size, layout and
effects instead of YouTube's stock embed.

Features:

* Paste a channel URL, @handle, or even a video link — the plugin resolves the
  channel ID automatically (no API key needed).
* Choose how often the server checks for a newer video: once, twice, 3x or 4x
  a day.
* Each channel is a row in a repeater and gets its own shortcode, so you can put
  different channels on different pages.
* Display options: inline or fullscreen overlay; full / three-quarter / half
  width; autoplay on click.
* Overlay: custom image and heading text (H1–H6 / paragraph / span).
* Background frame: none, solid colour (size + colour), or an "old TV set" look.
* Optional analogue TV "tune-in" static intro before the video starts.
* No analytics or tracking of any kind.

== How to use ==

1. Go to Settings → Latest YouTube Feed.
2. Click "+ Add another channel".
3. Paste the channel URL or @handle and click "Resolve".
4. Pick your frequency, display, overlay and background options.
5. Click "Save all feeds". Each feed shows its shortcode, e.g.
   `[latest_youtube id="yt12ab34cd"]`.
6. Paste that shortcode on any page or post.

Use "Sync now" on a feed to fetch the latest video immediately.

== Frequently Asked Questions ==

= Do I need a YouTube API key? =
No. The plugin uses YouTube's public RSS feed and public channel pages only.

= How fresh is "latest"? =
YouTube's RSS feed can lag a few minutes behind a brand-new upload. The plugin
checks on the schedule you set (up to 4 times a day).

= Can I show more than one channel? =
Yes. Add as many channels as you like; each gets its own shortcode.

== Changelog ==

= 1.26.4 =
* Tidied each feed's Status: the diagnostic lines (last checked, schedule summary, live due check, last cron decision) are now grouped under a collapsible "Cron status" reveal so the panel stays clean while keeping the detail available.

= 1.26.3 =
* Added a live due check to each feed's Status panel. It calculates immediately on admin page load whether the saved schedule is due right now, so standard-feed schedule problems can be diagnosed without waiting for WP-Cron to fire.

= 1.26.2 =
* Standard feed cron now records its last due/not-due decision per feed, including whether the hourly or 15-minute runner checked it and the exact reason it ran or skipped. The Status panel shows this so missed standard slots can be diagnosed from the admin screen.
* Corrected stale retry wording from "every hour" to "every 15 minutes".

= 1.26.1 =
* Each feed's Status now shows a plain-English summary of the schedule it actually has stored — the days it checks and the exact check times (or the news-mode window) — plus a warning when today is not one of the checked days. This makes it easy to confirm the form saved what you expected when a feed isn't updating.

= 1.26.0 =
* Added an "Automation status" panel at the top of the settings page showing whether WP-Cron is active, the current site time, and when the hourly and 15-minute checks last fired and are next due. Each feed's Status now also shows when it was last checked.

= 1.25.4 =
* Fast cron now catches late standard scheduled slots as well as retry windows. This means a feed scheduled for 14:00 can be picked up by the next 15-minute cron run after 14:00 even if the hourly master event is not due yet.

= 1.25.3 =
* Standard scheduled feeds now retry every 15 minutes (was 30) after a scheduled check until a new video is found, matching the News-mode cadence.

= 1.25.2 =
* Standard scheduled feeds now retry every 30 minutes after a scheduled check until a new video is found (or the retry window expires), then stop until the next configured time slot. This uses the fast cron while News mode remains every 15 minutes.

= 1.25.1 =
* Fixed standard scheduled feeds missing a check when WP-Cron runs late. A feed set to check at 14:00 now still runs at e.g. 15:13 if it has not synced since today's 14:00 slot, instead of requiring the cron to fire during the exact 14:00 hour.

= 1.25.0 =
* Added "News mode" for all-day channels. When enabled on a feed, the plugin checks the channel every 15 minutes (via a new 15-minute cron) instead of the 1–4 times-a-day schedule, which is greyed out. You can set an active-hours window (e.g. 06:00–23:00) so it skips overnight checks, and the chosen days-to-check and length filters still apply.

= 1.24.0 =
* The feed settings card is now split into collapsible sections (Channel & source, Schedule, Video selection, Display, Overlay image, Play button, Background & effects, SEO / Schema, Status) so a long card is easier to work down.
* Renamed the "Overlay" section to "Overlay image" and added an image alt-description field (used as the poster image alt text, falling back to the video title).
* Added an optional SEO / Schema section: enable structured data, pick a content category (News, Explainer, Interview, Sports, Fashion, Tech, Entertainment, Commentary, Documentary), add a short content description, and flag whether the page contains embedded video / is primarily video-based. When enabled, a VideoObject JSON-LD block is output for the embedded video.

= 1.23.3 =
* On phones the Maximise controls now stack vertically (POWER, VOL, ZOOM, MIN) at the top instead of a horizontal row that ran off the side of the screen, so every control stays reachable.

= 1.23.2 =
* Moved the Maximise controls to a safe top bar on phones so Power, Volume, Zoom and MIN stay visible above the video instead of being hidden by iPhone Safari's bottom browser controls.

= 1.23.1 =
* Fixed the Maximise view pushing the video off-screen (it was sized by width only, so it overflowed on landscape/wide screens). The picture now scales to fit the viewport, and the Power/Volume/Zoom controls sit in a slim bar. Tap MIN to return to the TV.

= 1.23.0 =
* Extra controls now include a Maximise button. It uses a CSS pseudo-fullscreen (the whole component pins to the viewport) so the video fills the screen on phones while the Power, Volume and Zoom controls stay overlaid — something native iPhone fullscreen can't do for custom controls. Tap again (MIN) or stop the video to return to the page.

= 1.22.1 =
* Reworked the "Extra controls" mode: the knobs are now a real Power on/off button, an old-style Volume fader (min–max), and a Zoom fader that magnifies the picture in place. Zoom no longer goes to native fullscreen, so the control panel stays visible the whole time. When the setting is off, the decorative knobs and playback behaviour are unchanged.

= 1.22.0 =
* Added an optional "Extra controls" setting for the Old TV set background. When enabled, the TV knobs become interactive: Power starts/stops the video, Volume cycles the player volume, and Zoom requests fullscreen. When disabled, the existing decorative knobs and playback behaviour are unchanged.

= 1.21.3 =
* Auto-close (and end-of-video return to poster) now waits 3 seconds after the video finishes, so the final frame/end card isn't cut off.
* The "Analogue TV tune-in" intro now also plays on mobile (it previously only ran on desktop). On touch devices playback starts within the tap so sound still works, with the tune-in noise shown over the intro before the picture is revealed.

= 1.21.2 =
* "Open in iframe overlay" layout now also starts with sound on the first tap on mobile, matching the inline players. The overlay player is preloaded hidden and revealed on tap, so iOS allows audible playback; if a device still blocks it, playback continues muted with a "Tap for sound" control. Inline behaviour is unchanged.

= 1.21.1 =
* Improved mobile click-to-play sound handling: inline mobile embeds now preload the YouTube player behind the poster so the first tap can try to start playback with sound. If iOS blocks audible playback, the plugin falls back to muted playback and shows a "Tap for sound" control.

= 1.21.0 =
* Fixed "autoplay on click" not working on mobile (iPhone/iPad Safari and Chrome). Mobile browsers block unmuted autoplay even when started from a tap, so on touch devices the video now autoplays muted — viewers can tap the player's volume control to unmute. Desktop autoplay (with sound) is unchanged.

= 1.20.0 =
* Features page now lists every capability, including the new "days to check", responsive player, and the Channel ID / RSS feed URL overrides.
* Added a "Copy features for social media" button on the Features page — copies a ready-to-paste, emoji-bulleted summary with hashtags.

= 1.19.0 =
* New "Days to check" option per feed: tick the days a channel actually posts (e.g. a trading channel Mon–Fri) so the plugin skips checks — and retries — on the other days. No more needless weekend checks.
* The Channel ID / RSS feed URL override is now hidden behind a "Show / edit" toggle so cards stay tidy; click to expand when you need it.
* Moved the "Analogue TV tune-in intro" control directly under the Background selector, with a note that it needs the "Old TV set" background and only works in inline mode. The intro is now disabled in the overlay layout to match.

= 1.18.1 =
* Fixed the analogue tune-in intro running on page load (before pressing play). The intro now plays only inline when the viewer presses play, and only when the "Old TV set" background is selected.

= 1.18.0 =
* New "RSS feed URL (override)" field per feed. Paste a full feed URL (e.g. one YouTube/Met Office gave you) to use it directly — it bypasses channel-ID resolution entirely. If set, it wins over the Channel ID for both scheduled syncs and the "Show RSS feed" preview.

= 1.17.0 =
* Channel ID is now a visible manual-override field with step-by-step helper text (open channel → Share channel → Copy channel ID). Paste a UC… ID to force the exact channel when Resolve picks the wrong one.
* Shows the live RSS feed URL for the current channel ID, updating as you type or resolve.

= 1.16.0 =
* Fixed channel resolving from an @handle or channel URL returning the wrong channel (e.g. a featured/related channel). The resolver now reads the page's canonical link / og:url first, which always points to the page owner, before falling back to looser markers.

= 1.15.0 =
* Fixed the length filter: a duplicate filter row caused the min/max values to overwrite each other on save (top values reverted to the other card's). Removed the duplicate.
* Length filter is now a single mode dropdown — "No filter", "Between two lengths" (both boxes), "Longer than" (one box), or "Shorter than" (one box) — so only the relevant box(es) show.

= 1.14.0 =
* Moved out of Settings into its own top-level "YouTube Feed" menu in the dashboard, with two submenus: Channels (manage feeds) and Features (an overview of everything the plugin can do).

= 1.13.0 =
* Length filter: optionally skip videos outside a length range (ignore shorter than X minutes, ignore longer than Y minutes). Useful for skipping Shorts or long livestreams. Scans the newest videos until one matches. Duration is read from the video page (cached, no API key).

= 1.12.0 =
* Admin: feed cards are now collapsible. Click a card header to expand/collapse it. Adding a new channel auto-collapses the existing ones, and already-configured feeds start collapsed on load (when there's more than one), keeping the page tidy.

= 1.11.0 =
* Overlay close bar is now a full-width bar across the top of the screen (Met Office style), with the video centred below it.
* New options: overlay bar colour and bar text colour (e.g. black bar with bright text). The close button border follows the text colour.

= 1.10.0 =
* Overlay reliability: "Open in iframe overlay" now uses a Met Office-style body-level fixed overlay layer instead of making the shortcode wrapper fixed. This prevents theme/page-builder columns, transformed parents, and stacking contexts from hiding the dark background or close bar.
* Auto-close still uses the YouTube API player inside that overlay when enabled; non-auto-close uses a plain iframe.

= 1.9.0 =
* "Old TV" exterior reworked to look like a physical 1980s CRT unit: moulded dark-walnut/brown plastic casing, layered weight shadows, inner bevel (top-left highlight, bottom-right shade), recessed glass screen, and a soft grounding shadow under the set. All existing internal effects (scanlines, signal, tune-in, knobs) are unchanged.

= 1.8.0 =
* New option: "Auto-close overlay when the video ends" (Met Office–style). When on, the overlay uses the YouTube API player so it can detect the end and close itself, with an automatic fallback to the plain iframe if the API doesn't load.

= 1.7.0 =
* Overlay now opens the video in a plain, reliable YouTube iframe over a full-page dark background with a "Close video" bar above it (Met Office–style). No longer depends on the YouTube JS API loading, so it works on more hosts.
* Renamed the layout option to "Open in iframe overlay" and added guidance so the effect is easy to find. Note: it only shows when a feed's Layout is set to this option (Inline is the default).

= 1.6.1 =
* Fix: every set check time now runs its own check. Finding a video at one slot no longer cancels later slots the same day (matters for 2–4×/day feeds).

= 1.6.0 =
* Auto-retry: if the new video isn't up at the scheduled check time, the feed now keeps retrying every hour (up to 12 hours) until it appears, then stops until the next day.
* Admin: scheduling tip ("set the check ~1 hour after the channel publishes") and a live "waiting for a newer upload" status while a feed is retrying.

= 1.5.0 =
* Play button: full colour control — background colour + opacity, icon colour, border colour, border width, and overall size. The triangle scales with the button.
* Hover now brightens the button (colour-agnostic) instead of forcing red.

= 1.4.0 =
* Overlay text: choose vertical position (top / centre / bottom, all horizontally centred).
* Overlay text: font-size presets (Small–XX-Large, responsive) on top of the H1–H6 tag.
* Overlay text: font family — theme default or one of four web-safe fonts (System sans, Arial/Helvetica, Georgia, Times New Roman).
* Admin: recommended overlay image size guidance (16:9, 1280×720+).

= 1.3.0 =
* Fullscreen overlay layout now shows a "Close video" bar directly above the video (with the title), matching the video width, instead of a small corner button. The video still sits on a dark backdrop. Esc also closes.

= 1.2.0 =
* Reworked "Old TV set" into a full 1980s CRT television: 80% screen + 20% dark-walnut control casing with 3D channel/volume/tuning knobs.
* CRT screen: darkened curved glass, scanlines, edge glow, vignette, and subtle signal drift/jitter/brightness breathing (paused during playback).
* Load-time "channel finding" static that settles into the picture (gated by the analogue tune-in option; respects reduced-motion).
* Existing analogue tune-in on click is unchanged.

= 1.1.0 =
* Add manual video override per feed (pin one video as a fallback if the feed fails).
* Show the channel's recent videos from RSS on the settings page, with one-click "Use" to pin a video.
* Per-feed scheduled check times: pick the exact hour(s) of day to check, matching the chosen frequency.
* Enhanced "old TV" background with side control knobs and a speaker grille.

= 1.0.0 =
* Initial release.
