Help With Rotating YouTube Video Script?

by 3 replies
5
Hey guys, I've been searching for a script that would allow me to have 3-4 youtube or vimeo videos rotate on each refresh of my site. I haven't really found anything yet that I can make heads or tails out of.

Is anyone familiar with a script that would let me do this on my site or knows of the proper html maybe?

Basically I have a video widget in my sidebar of my wordpress blog and I would like 4 videos to be rotated upon each visit and on each new page as the user navigates through the site.

Thanks much!
#website design #rotating #script #video #youtube
  • I dont think im allowed to promote my own products, so ill just give you the php code.

    Code:
    <?
    $video[] = "HTML Video Code 1";
    $video[] = "HTML Video Code 2";
    $video[] = "HTML Video Code 3";
    $video[] = "HTML Video Code 4";
    
    echo $video[rand(0,count($video)-1)];
    ?>
    Be carefull with quotes when adding the actual video code to each variable, either use single quotes or escape any double quotes.
    • [1] reply
    • Will this work on the pages you create as well, with out the widget side bar? Still a little new at this... Where exactly would that code go on the php? Thanks for your help I have been searching high and low for the last week... lol
  • Thanks Rob, you helps me to solve my problem too.

Next Topics on Trending Feed

  • 5

    Hey guys, I've been searching for a script that would allow me to have 3-4 youtube or vimeo videos rotate on each refresh of my site. I haven't really found anything yet that I can make heads or tails out of. Is anyone familiar with a script that would let me do this on my site or knows of the proper html maybe?