WordPress.org

Ready to get started?Download WordPress

Forums

Random photo plugin (4 posts)

  1. jmeeter
    Member
    Posted 5 years ago #

    Is there a plugin that will show a random photo in my sidebar? Any photo that has been uploaded to my blog, I mean.

  2. jmeeter
    Member
    Posted 5 years ago #

    Bump.

  3. theMezz
    Member
    Posted 5 years ago #

    I am looking for a way to put a random image in the header. Anyone???

  4. FWDrew
    Member
    Posted 5 years ago #

    @theMezz-This post is a little dated but oh well :)

    A quick google search brought these two up, give them a look:
    Plugin 1
    Plugin 2

    This could also be done pretty quickly if your comfortable placing some php in your sidebar. A super quick example, not tested:

    <?php
       $randomNumberAd=rand(1,15);
       if($randomNumberAd <=5 ){
       $randomAdUrl = '<img src="path/to/your/image1" alt="Img 1" />';
       }
       elseif($randomNumberAd >= 10) {
        $randomAdUrl = '<img src="path/to/your/image2" alt="Img 2" />';
       }
       else {
       $randomAdUrl = '<img src="path/to/your/image3" alt="Img 3" />';
       }
       ?>
    <!--Usage Below-->
    <div class='yourAdClass'><?php echo $randomAdUrl; ?></div>

    Best Regards,

    Drew

Topic Closed

This topic has been closed to new replies.

About this Topic