My YouTube Channel addon for WordPress allows you to display widgets with the latest or random video from a YouTube channel or playlist. After installation, add the widget to the sidebar, enter the name of the channel or playlist ID, and the latest video from the selected resource will be shown on your site.
Jump to: Features | Download | Installation | FAQ | YouTube Data API Key | Usage | Shortcode | Customize | Your Support
Features
- Show one or more videos from the user channel or playlist as a thumbnail opened in lightbox Bigger Picture (default), HTML5 (iframe), Asynchronous HTML5 (iframe2) or Embed Playlist (playlist)
- Sort videos in natural, as well as random order.
- Embed single videos or embeddable playlist block (grouped all videos from channel or playlist).
- Choose the preferred aspect ratio of displayed videos and thumbnails (16:9 or 4:3)
- Enable video autoplay (not on mobile devices) with optionally muted videos.
- Add it as a widget or inline element to the page content with a shortcode (WPBakery Page Builder ready).
- Toggle the video title and display the above/below/inside video and/or video description.
- Display a link to the channel or handle on YouTube.
Download
The ChangeLog you can find here. To download the plugin, visit the official WordPress.org page https://wordpress.org/plugins/youtube-channel/ or get the package from below:
- Fix: double trailing slash in assets URLs
- Fix: thumbnails lightbox does not work with enabled cache or auto optimize
- Update: Bigger Picture library to 1.1.7
Installation
YouTube Data API Key
Version 3 brings support for YouTube Data API v3. To make the plugin work, you must generate your own YouTube Data API Key and insert it on the Global plugin settings page.
Learn more about Obtaining authorization credentials and watch the explanation video below.
While you follow the video tutorial above, you are free to create Server Key. NEWER SHARE YOUR API KEY WITH OTHERS!
Usage
Straightaway after activation on the Plugins page, update global plugin settings, then add the widget to the sidebar on Appearance → Widgets, and proceed with widget configuration.
Until you set your preferred Channel ID in plugin settings, in the meantime your website will show a video from my channel. All other options are optional.
Shortcode
You can also insert a YTC block with a shortcode
Oops, something went wrong.
All options for the shortcode are taken from the global settings page, but you can override them by setting individual options to shortcodes.
General Settings
class
(string) custom class for YTC block to target special stylingchannel
(string) The ID of your preferred YouTube channel, and can get it from https://www.youtube.com/account_advancedvanity
(string) DEPRECATED custom vanity nameusername
(string) DEPRECATED legacy YouTube usernameplaylist
(string) The ID of the preferred YouTube playlist.resource
(int) A resource to use for feed:0
Channel1
DEPRECATED Favourited videos (for defined channel)2
Playlist3
DEPRECATED Liked videos (for defined channel)
cache
(int) The period in seconds for caching feed. You can disable caching by setting this option to0
, but if you have a lot of visits, consider at least short caching (a couple of minutes).fetch
(int) Number of videos that will be used as stack for random pick (min 2, max 50)num
(int) The number of videos to display per YTC block.random
(bool) Option to randomize videos on every page load.
Video Settings
ratio
(int) Set preferred aspect ratio for thumbnail and video. You can use:3
16:9 (widescreen)1
4:3
responsive
(bool) To enable responsive thumbnail or embedded video player.width
(int) Width of thumbnail and video in pixels.display
(string) An object that will be used to represent the video. We have a couple of predefined options:thumbnail
Thumbnails will be used and the video will be loaded in the lightbox.iframe
HTML5 (iframe)iframe2
HTML5 (iframe) with asynchronous loading – recommendedpalylist
Embedded playlist
no_thumb_title
(bool) By default, the YouTube thumbnail will have a tooltip with info about the video title and date of publishing. By setting this option to1
ortrue
you can hide the tooltipthemelight
(bool) By default, YouTube has a dark play controls theme. By setting this option to1
ortrue
you can get a light theme in the HTML5 playercontrols
(bool) Set this option to1
ortrue
to hide playback controls.autoplay
(bool) Enable autoplay of the first video in the YTC video stack by setting this option to1
ortrue
mute
(bool) Set this option to1
ortrue
to mute videos set to autoplay on loadnorel
(bool) Set this option to 1 or true to hide related videos after finished playbacknobrand
(bool) Set this option to 1 or true to hide the YouTube logo from the playback control barnolightbox
(bool) Set this option to 1 or true to prevent the YTC block with the thumbnail to open in the lightbox. If you have another plugin that triggers youtube links for lightbox, that one will steal links from this YTC block.target
(string) If you enablenolightbox
for specific YTC blocks, you can force the opening of thumbnail links in a new tab/window if you set this shortcode option to_blank
liketarget="_blank"
.
Content Layout
showtitle
(string)none
Do not display the video titleabove
Display the video title above the videobelow
Display the video title below the videoinside
Display top-aligned title inside thumbnail; ifdisplay
is notthumbnail
then treat asabove
inside_b
Display bottom aligned title inside thumbnail; ifdisplay
is notthumbnail
then treat asbelow
titletag
Video title HTML tag to wrap title (H3, H4, H5, div, span, strong, etc)showdesc
(bool) Set to 1 or true to show video description. Disabled by default.desclen
(int) Set the number of characters to cut down the length of the video description. Set to 0 (zero) to use full-length description.noinfo
(bool) Set to 1 or true to hide overlay video info (from an embedded player)noanno
(bool) Set to 1 or true to hide overlay video annotations (from an embedded player)
Link to Channel
link_to
(string) URL where link will lead:none
Hide link (default)vanity
Vanity custom URLchannel
Channel pagelegacy
Legacy username page
popup
(int) Control where the link to the channel will be opened:0
(int) Open link in the same window1
(int) Open link in new window with JavaScript2
(int) Open link in new window with target=”_blank” anchor attribute
goto_txt
(string) Text that will be set for link
Shortcode Example
Plop of Flensburger Weizen bottle
Shortcode Explained
- Get one (
num=1
) random (random=1
) video from the YouTube channel (resource=0
) UCRPqmcpGcJ_gFtTmN_a4aVA (channel=UCRPqmcpGcJ_gFtTmN_a4aVA
) - Cache feed for one hour (
cache=3600
) - Automatically start video playback (
autoplay=1
) in responsive HTML5 player with asynchronous load (show=iframe2
) - And show a link to Vanity URL below the YTC block (
link_to=vanity
)
Customize the look and feel
We implemented classes for all My YouTube Channel objects, so we can easily style the presence of YTC by personal preferences. Simply add to style.css for your theme styling for classes:
- .widget_youtube-channel – class of the whole widget (parent for widget title and YTC block)
- .youtube_channel – YTC block wrapper class. Additional classes are available:
- .default – for non-responsive block
- .responsive – when you have enabled the responsive option
- .ytc_title – class of H3 tag for video title above thumbnail/video object
- .ytc_video_container – class of container for a single item, plus:
- .ytc_video_1, .ytc_video_2, … – class of container for a single item with ordering number of items in the widget
- .ytc_video_first – class of the first container for a single item
- .ytc_video_mid – class of all other containers for a single item
- .ytc_video_last – class of the last container for a single item
- .ar16_9 – class for Aspect Ratio 16:9
- .ar4_3 – class for Aspect Ration 4:3
- .ytc_thumb – class of anchor for Thumbnail mode
- .fluid-width-video-wrapper – class for parent element of IFRAME for enabled responsive
- .ytc_description – class for video description text below thumbnail/video object
- .ytc_link – class of container for a link to the channel
And we appreciate your support
Spread voice about My YouTube Channel on social networks, and rate and review the plugin on WordPress.org