Forums

Lightbox Plus
Youtube thumbnail & Lightbox (2 posts)

  1. Nedudgi
    Member
    Posted 1 year ago #

    Is there any way to use youtube thumbnail and to capture and show the video in a Lightbox?
    When I tried this it worked only with text link. (Or I don't know how to link a thumbnail.)

    http://wordpress.org/extend/plugins/lightbox-plus/

  2. Xiyangchou
    Member
    Posted 4 months ago #

    Here's the basic idea:

    you can get the thumbnail for the video by using this address:
    http://img.youtube.com/vi/VIDEOIDGOESHERE/0.jpg (can also use 1.jpg, 2.jpg or 3.jpg)

    what I did was this:

    $output = get_the_content();
    $output = str_replace("http://www.youtube.com/watch?v=", "", $output);
    
    <p><a class="lbpModal" href="http://www.youtube.com/embed/'. $output .'?wmode=transparent&fs=1&hl=en&modestbranding=1&loop=0&iv_load_policy=3&showsearch=0&rel=0&theme=dark"><img class="video" src="'. get_bloginfo('template_url') .'/img/video.png" /></a><img class="videoPicture" src="http://img.youtube.com/vi/'. $output .'/0.jpg" />';

    I created an image to overlay on the thumbnail so you knew it was a video and tweaked that with css. This code loads the video image I made and the youtube thumbnail and the link is a property of the video image. The <a class="lbpModal"> is whatever class you set your secondary lightbox settings to be.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic