Skip to content

Auto Embed

    Easily Embed Dynamic Lazy Loading Youtube Videos, Facebook Pages, PDFs, Images, etc. Simply By Pasting The Url.

    This plugin does most of the work client side, and waits for the page to finish loading so embeds do not slow down your site.
    Shortcodes are not needed (but are available), just add a clickable link to the youtube video, and the plugin will find all the youtube.com and youtu.be links, and replace them with an embed.

    You know how sites like facebook and discord let you paste a youtube url, and an embed of the video shows up?
    This plugin works kind of like that, while also working with playlists, live streams, channels, youtube search, etc.

    YouTube has an organized url system, and this plugin recognizes it.
    Every youtube playlist id starts with “PL”, and youtube uses many other consistent url methods like this.


    This plugin is Not limited to WordPress. You can embed it directly into your site as a JavaScript CDN.

    CDN Installation
    + -
    <!-- jquery dependency -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <!-- or alternatively jqAlt (by AspieSoft) - v0.0.16 (alpha) or later -->
    <script src="https://cdn.jsdelivr.net/gh/AspieSoft/[email protected]/jqalt/index.js"></script>
    
    <script src="https://cdn.jsdelivr.net/gh/AspieSoft/[email protected]/cdn/embed.js"></script>
    CDN Config
    + -
    // add this before the cdn script is loaded
    AspieSoftAutoEmbedOptions = {
      'width': '100%',
      'min-width': '300px',
      'max-width': '2500px',
      'ratio': '16:9',
      'auto': '0',
      'mute': '0',
      'popular': '0',
      'live': '0',
    
      'ignoreAttrs': ['class', 'id', 'name', 'target'], // optional [array] list of attributes to ignore
      'ignoreClass': null, // optional [array] list of classes to ignore (reverses to required if ignoreAttrs includes "class")
      'requireAttrs': null, // optional [array] list of attributes to require
    
    
      yt: { // seperate options for youtube embeds
        'width': '100%',
        'min-width': '300px',
        'max-width': '2500px',
        'ratio': '16:9',
      },
    
      fb: { // seperate options for facebook page embeds
        'width': '100%',
        'min-width': '300px',
        'max-width': '2500px',
        'ratio': '16:9',
      },
    
      pdf: { // seperate options for pdf
        'width': '100%',
        'min-width': '300px',
        'max-width': '2500px',
        'ratio': '9:12',
      },
    
      img: { // seperate options for images
        'width': '100%',
        'min-width': '300px',
        'max-width': '2500px',
        'ratio': '16:9',
      },
    
    };
    How to embed a live stream
    + -

    Just add "?live" or "&live" to the url. The plugin checks query parameters of the url and makes changes as needed

    How to embed the popular uploads from your channel
    + -

    Add a link to your YouTube channel and add "?popular" or "&popular" to the url

    How to change the width of an embed
    + -

    Add "?width=" to the url.
    Same for "?min-width=" and "?max-width=" for a minimum and maximum width

    How to change the ratio of an embed
    + -

    Add "?ratio=w:h" to the url. Replace "w" with the ratio width, and "h" with the ratio height

    How to embed a playlist based on a youtube search
    + -

    Set the link to "https://youtu.be/?search=1"

    Leave a Reply

    Your email address will not be published.