# YouTube Embed

Effortlessly embed YouTube videos on your website to enhance engagement and showcase content.

If your website runs on Bootstrap 5+ and Solodev version 11.0.66 or higher, use the shortcode below. Otherwise, click here.

# YouTube Embed - Newer Versions

Attributes:

Attributes Description
embed_link_id (Required) The YouTube video ID.
ratio (Optional) Aspect ratio of the video. (Default: 16x9).
id (Optional) Custom HTML ID for the element.
class (Optional) Custom HTML classes for styling.
title (Optional) Video title for accessibility (ADA compliance).
allowfullscreen (Optional) Set to false if you don't want to allow the embedded video or content to be viewed in full-screen mode. (Default: allowfullscreen).

Shortcode:

[youtube_embed embed_link_id="5BNPeFHU7QQ"]

Example:

[youtube_embed embed_link_id="5BNPeFHU7QQ" ratio="4x3" id="my-id" class="my-class" title="Youtube Video" allowfullscreen="false"]

# YouTube Embed - Older Versions

The YouTube video shortcode has two attributes, one required and one optional, listed below.

Attributes:

Attributes Description
id (Required) Specify the YouTube video id.
aspect_ratio (Optional) Specify the YouTube video aspect ratio. Default is 16by9.

Shortcode:

[youtube id="5BNPeFHU7QQ"]

Example:

[youtube id="5BNPeFHU7QQ" aspect_ratio="4by3"]

# Video ID

To obtain the video id:

  1. Browse to the YouTube page where your video is hosted.

  2. Click the Share button on the right just below the video.

  3. Select the Embed Link and copy the video's YouTube ID. For example, if the link reads https://www.youtube.com/embed/5BNPeFHU7QQ, you only need to copy the 5BNPeFHU7QQ after the forward slash.

  4. Insert the shortcode at the appropriate place in the tpl or html file associated with your page.

[youtube id="5BNPeFHU7QQ"]
  1. Click Publish.