WP YouTube Lyte Shortcode

Below, you’ll find a detailed guide on how to add the WP YouTube Lyte Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the WP YouTube Lyte Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the WP YouTube Lyte Plugin and the shortcodes it provides:

Plugin Icon
WP YouTube Lyte

"WP YouTube Lyte is a powerful WordPress plugin designed to optimize your YouTube videos. It seamlessly reduces load time, ensuring a smooth viewing experience for all users."

★★★★☆ (192) Active Installs: 30000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [lyte]

WP YouTube Lyte [lyte] Shortcode

The wp-youtube-lyte plugin shortcode ‘lyte’ allows users to embed YouTube videos or playlists with customizable features. It accepts parameters like ‘id’ for video ID, ‘audio’ for audio-only mode, ‘playlist’ for embedding playlists, ‘start’ for start time, ‘showinfo’ to toggle video info, ‘stepsize’ for step size, and ‘hqthumb’ for high-quality thumbnails. It generates a URL to parse the video or playlist from YouTube.

Shortcode: [lyte]

Parameters

Here is a list of all possible lyte shortcode parameters and attributes:

  • id – Unique identifier for the YouTube video or playlist.
  • audio – If set, the video will be played as audio only.
  • playlist – If set, the video will be played in a playlist format.
  • start – Defines the start time of the video in seconds.
  • showinfo – If set to ‘false’, video title and uploader will not be shown.
  • stepsize – Defines the increment step size for video timeline.
  • hqthumb – If set, a high-quality thumbnail will be used for the video.

Examples and Usage

Basic Example – A simple usage of the ‘lyte’ shortcode to embed a YouTube video using its video ID.

[lyte id="dQw4w9WgXcQ" /]

Advanced Examples

Embed a YouTube video with a specified start time. The ‘start’ parameter is set in seconds.

[lyte id="dQw4w9WgXcQ" start="45" /]

Embed a YouTube video without showing video info. The ‘showinfo’ parameter is set to ‘false’.

[lyte id="dQw4w9WgXcQ" showinfo="false" /]

Embed a YouTube audio with a high-quality thumbnail. The ‘audio’ and ‘hqthumb’ parameters are set to ‘true’.

[lyte id="dQw4w9WgXcQ" audio="true" hqthumb="true" /]

Embed a YouTube playlist using its playlist ID. The ‘playlist’ parameter is set to ‘true’.

[lyte id="PL2fnLUTsNyq7A335zB_RpOzu7hEUcSJbB" playlist="true" /]

These examples showcase the versatility and flexibility of the ‘lyte’ shortcode, allowing you to customize the way you embed YouTube videos or playlists on your WordPress site.

PHP Function Code

In case you have difficulties debugging what causing issues with [lyte] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'lyte', 'shortcode_lyte' );

Shortcode PHP function:

function shortcode_lyte( $atts ) {
    extract( shortcode_atts( array(
        'id'       => '',
        'audio'    => '',
        'playlist' => '',
        'start'    => '',
        'showinfo' => '',
        'stepsize' => '',
        'hqthumb'  => '',
    ), $atts ) );

    $qs = '';

    if ($audio) { $proto = 'httpa'; } else { $proto = 'httpv'; }
    if ( $start !== '' ) { $qs .= '&start=' . $start; }
    if ( $showinfo === 'false' ) { $qs .= '&showinfo=0'; }
    if ( $hqthumb ) { $qs .= '&hqThumb=1'; }
    if ( $stepsize ) { $qs .= '#stepSize=' . $stepsize; }
    if ( $playlist ) { $action = 'playlist?list=';} else { $action = 'watch?v='; }

    return lyte_parse( $proto . '://www.youtube.com/' . $action . $id . $qs );
}

Code file location:

wp-youtube-lyte/wp-youtube-lyte/wp-youtube-lyte.php

Conclusion

Now that you’ve learned how to embed the WP YouTube Lyte Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *