HTML code rotator or plugin?

2 replies
Hello

I am looking for either a script or a wordpress plugin that rotates a piece of HTML code in a page. It would be similar to a banner rotator, but just doesn't apply to images.

I am ultimately trying to display more than one opt in form at random on my site.

If anyone could help me with this it would be awesome!

Thanks
#code #html #plugin #rotator
  • Profile picture of the author aisdbuilder
    Hi there Travis,

    You could possibly add each rotating piece of html to an array key number. And then, using php's rand function to get a particular number, you can echo out that particular bit of html.

    For example,

    <?php
    $html_array[0] = "<p>peice of html code 0</p>";
    $html_array[1] = "<p>peice of html code 1</p>";
    $html_array[2] = "<p>peice of html code 2</p>";

    $random_number = rand(0, 2);
    echo $html_array[$random_number];
    ?>

    Hopefully that will help out!
    {{ DiscussionBoard.errors[6069259].message }}

Trending Topics