How to Display YouTube/Vimeo Videos in Lightbox in WordPress

Today, we are going to share an easy way to display YouTube or Vimeo videos in lightbox in WordPress via shortcode. We’ll use WP Video Lightbox plugin for this. So, download the plugin the from here and install.


After activation, go to Settings -> Video Lightbox.


In general option, check “Enable jQuery” if you haven’t added jQuery library yet. Otherwise, uncheck the option.

Now click on “prettyPhoto” tab (as the plugin uses prettyPhoto library). There you’ll see many lightbox options. Leave the options as it is, or you can make some changes in configuration. Following are the shortcodes for embedding videos of different types (YouTube, Vimeo). You can also embed flash videos and iframes.

How to embed YouTube in lightbox

For embedding YouTube videos, you will need the specific video id.

[code type=”php”]
[video_lightbox_youtube video_id=”xxxxxxxx” width=”600″ height=”400″ anchor=”open YouTube video”]

xxxxxxxx = YouTube’s video ID
width = Width of the video
height = Height of the video
anchor = Anchor text. Text could be image, so for image you’ll have to attach an image url (

How to embed Vimeo in lightbox

Format for embedding vimeo’s video is:

[code type=”php”]
[video_lightbox_vimeo5 video_id=”13562192″ width=”640″ height=”480″ anchor=”click here to open vimeo video”]

Now you can embed these shortcodes in any post or page. Remember to put a valid YouTube or Vimeo’s valid video ID.

Duan Lingxin

Duan Lingxin

Content crafter and chief editor at Scratching Info. Also regular contributor on other major online tech platforms. Security Specialist by day and a writer by night, he does his best to instill his knowledge about tech while delivering inspiring and life changing resources through his writing,

More Posts - Website

Leave a Comment