| 开发者 |
rstake
sdaweb |
|---|---|
| 更新时间 | 2026年10月31日 17:10 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
exclude_shorts="true" removes YouTube Shorts from any list; the block and the Shortcode Builder have the same switch.[sdawchfo_live] shows only live and upcoming streams, with "Live now" and "Coming up" headings and a friendly empty state.youtube.com/@handle, /channel/UC…, /user/name), by handle or by channel ID.ids attribute.[sdawchfo_channel id="UC…"] – videos from one channel (by id, handle or label).[sdawchfo_channels] – several channels in a grid, tabs or slider.[sdawchfo_feed] – one combined list of the newest or most-viewed videos across channels.[sdawchfo_live] – live and upcoming streams only.count, columns, layout, sort, player, pagination, per_page, show_stats, show_duration, show_channel, show_description, exclude_shorts, live_only and (for multi-channel shortcodes) ids. The live shortcode takes ids, count, columns, player, show_channel, show_stats, show_duration, show_description and empty_message. The Shortcode Builder on the Dashboard writes them for you, and the Settings page has a full reference table with examples.
Block editor
The YouTube Channel block offers the same choices as the shortcodes – channel selection, layout, columns, count, sort, player, pagination, Live Only, Show Description and Exclude Shorts – with a styled live preview in the editor.
Customisation
--sdawchfo-card-bg, --sdawchfo-surface, --sdawchfo-surface-alt, --sdawchfo-text, --sdawchfo-muted, --sdawchfo-border, --sdawchfo-accent.docs/hooks.md in the plugin folder.sdaweb-channels-for-youtube folder to /wp-content/plugins/, or install it from Plugins → Add New.From the Google Cloud Console: create a project, enable the YouTube Data API v3 and create an API key. It is free: Google gives every project 10,000 quota units per day. The Settings page has a step-by-step guide with the exact URL pattern to restrict the key to your site.
A site with one channel uses about 300 units a day, almost all of it for the 5-minute live check. Ten channels on the default 6-hour refresh use roughly 400 units. Broadcast Boost adds about 150 units per channel for every hour it is active. Visitors never use quota. The Dashboard shows the state of the connection, and if the quota is ever used up, cached videos keep showing until Google resets the quota at midnight Pacific time.
Add exclude_shorts="true" to the shortcode, for example [sdawchfo_feed exclude_shorts="true"], switch on Exclude Shorts in the block, or tick the box in the Shortcode Builder. Shorts are recognised from the channel's own Shorts list, so Shorts up to three minutes long are caught too. To hide them site-wide without editing shortcodes, add this to your theme's functions.php:
add_filter( 'sdawchfo_video_query_args', function( $args ) { $args['exclude_shorts'] = true; return $args; } );
By default every 6 hours; choose anything from 1 to 24 hours in Settings. Live status is checked every 5 minutes. Channel name, avatar and subscriber count are refreshed once a day. Use Refresh or Refresh All on the Channels page to update immediately.
Add define('DISABLE_WP_CRON', true); to wp-config.php and create a cron job on your server that calls https://yoursite.com/wp-cron.php?doing_wp_cron every minute. The Settings page shows the exact command for your site. This is strongly recommended if you use Broadcast Boost.
Every 5 minutes the plugin asks YouTube about the videos that could be live: known live or upcoming streams, recent uploads, and anything new in the channel's RSS feed (which costs no quota). Live streams get a red LIVE badge with the viewer count; scheduled streams get a blue UPCOMING badge with a countdown. They are automatically excluded from the normal shortcodes and shown by [sdawchfo_live] or live_only="true".
A weekly time window during which the live check runs every minute instead of every 5, so a stream that starts at 10:30 appears on your site within a minute. Set the day and the time range in Settings. Outside the window the normal 5-minute check continues.
Auto (default) opens a lightbox on desktop and tablet and plays inline on phones; good for most sites. Lightbox always uses the overlay with previous/next navigation. Inline always plays inside the card and offers an expand button. Link sends visitors to YouTube in a new tab. Set it per shortcode or block.
Yes. Page caches (WP Rocket, LiteSpeed Cache, Cloudflare, host caches) serve the plugin's HTML like any other content, and Load More keeps working on cached pages. Object caches (Redis, Memcached) are supported; the plugin's own caches are invalidated correctly when videos or settings change.
Drag channels into the order you want on the Channels page; that order is used everywhere. For a different order on one page, list channel IDs in the shortcode: [sdawchfo_channels layout="tabs" ids="UCabc,UCxyz"].
Yes, up to 100 per channel with count="100". Combine it with pagination="loadmore" and per_page to show a first batch and load the rest on demand.
Set the CSS variables on your body or theme wrapper, for example --sdawchfo-card-bg: #1e1e1e; --sdawchfo-surface: #1e1e1e; --sdawchfo-text: #f3f3f3; --sdawchfo-muted: #b0b0b0; --sdawchfo-border: #333;. Badge, button and tab colours have their own settings under Settings → Appearance.
Yes. Settings → Frontend Labels lets you edit all 29 texts, from the Load More button to the screen-reader announcements, in any language and without translation files.
They are removed from your site at the next refresh of that channel. If YouTube ever answers with something that is not video data, the plugin keeps the cache instead of emptying it and shows the error on the Channels page.
Yes. Settings → Import / Export downloads a JSON file with channels and settings (the API key is not included). Import it on the other site and run Refresh All.
No. The key is used only on your server and is never sent to the browser. Since 1.6.0 it is not even printed into the settings page; the field shows a masked hint instead.
The plugin uses YouTube's privacy-enhanced domain (youtube-nocookie.com) and no tracking scripts, which satisfies most blockers. If a video still does not play, the browser's own blocker is stopping the YouTube player itself; allow it for your site via the shield icon.
exclude_shorts="true" on [sdawchfo_channel], [sdawchfo_channels] and [sdawchfo_feed], an "Exclude Shorts" switch in the block and a checkbox in the Shortcode Builder. Requested on the support forum.sdawchfo_refresh_channel_failed action for developers.count="0" or per_page="0" no longer break a feed; import on hosts without direct filesystem access gives a clear message; Broadcast Boost refuses impossible times; Dashboard "Last refresh" times are read as UTC like the Channels list.youtube.com/user/NAME URLs are looked up by username, /c/ URLs get a clear hint, handles with non-Latin letters are accepted; counts round correctly (999,950 showed as "1000K") and use the site's decimal separator; screen readers hear the number of videos actually added.