Viewing 25 posts - 1 through 25 (of 25 total)
  • Author
  • #7372


    How is it possible to randomize background photo on home page?

    Thank you



    I’m not sure if this is (easily) possible but you can try following mod – open up includes/helper-slideshow.php and replace:

    $this->slides 		= avia_post_meta($this->post_id, 'slideshow');


    $this->slides 		= avia_post_meta($this->post_id, 'slideshow');
    shuffle($this->slides );


    Dude, could you tell me how to randomize background photo on EVERY page ?

    I think it’s a little boring when guest sees always the same first photo. I’ve tried to make few galleries, different on every page but i’m not satisfied…


    If the code provided by Dude works I believe you can do this like this:

    $this->slides 		= avia_post_meta($this->post_id, 'slideshow');
    shuffle($this->slides );


    Sorry, also interested in randomizing the background gallery, but in helper-slideshow.php I can’t find the code provided by dude (Flashlight V 1.3) – where do I have to look? Thanks



    it’s in includes/helper-slideshow.php – please search again (and use offline editors like notepad++). Maybe try to search for some text parts only.


    Sorry, again not found. Searched in offline-editor for slide, meta, $this, post_id but nothing found which nearly matched your given code. Which line do you mean? (Flashlight V1.3 – includes/helper-slideshow.php)


    I have searched whole folder by notepad++ and nothing found :(


    Ok – I’m sorry. Something changed V1.3 in includes/helper-slideshow.php search for:

    foreach($attachments as $key => $attachment)

    and replace it with:

    shuffle($attachments );
    foreach($attachments as $key => $attachment)


    That’s it, now it works fine! Thanks!


    Glad that I could help you :)


    Yes, it works fine :) but why only at start page ? I’ve set default gallery at every page… Is it possible to set it to the whole pages ?


    OK it works :) But is any other way to randomize default background gallery ? Unfortunately this way it shuffles every gallery (portfolio, blog).


    Allright, I solved the problem with default gallery at homepage only – I made some mistake when I moved blog form /blog folder one level up.

    Do you have any idea how to randomize background gallery without randomize gallery at my blog ? Right order photos in my blog is very important form me. I’ll be really thankful :)


    I haven’t tested it but try following – in template-blog.php replace:

    get_template_part( 'includes/loop', 'index' );


    $avia_config['currently_viewing'] = 'blog';
    get_template_part( 'includes/loop', 'index' );

    and replace:

    shuffle($attachments );
    foreach($attachments as $key => $attachment)


    global $avia_config;
    foreach($attachments as $key => $attachment)
    if($avia_config['currently_viewing'] != 'blog'){
    shuffle($attachments );
    foreach($attachments as $key => $attachment)


    Unfortunatelly still the same :(


    Did you set your blog page via the Flashlight option panel?


    Yes, I did. Does it matter if it site name begins from a capital letter ?


    I just saw that Kriesi doesn’t call the avia_config variable. I changed the code above a bit. Please try it again.


    It doesn’t work :(

    You can see it at

    I checked it twice. Blog page is set to blog in Flashlight menu.

    Try to visit my portfolio and blog sub-pages. Images in galleries are still mixed :( Background default gallery works fine – I really like it :)


    Then I think it’s not easily possible because wordpress doesn’t offer an option to determine the blog page. It would require some framework changes…


    Hmmm… that’s interesting… I was trying other galleries and it seems that it works only at WordPress Default Gallery attached to the entry. Maybe this way it looks less interesting but it works like I wanted it to :)

    Anyway thanks to you for help!



    Jacking a thread as opposed to starting completely fresh as its almost the same request.

    Is there a way to have the Default Background Image Gallery use only the featured images from each Post automatically, and If not, is it possible to suggest it as a possible feature for a future update?



    I have put:

    shuffle($attachments );

    foreach($attachments as $key => $attachment)

    But would actually like the default gallery or home page only to be shuffled… !

    >> It would be great to have a “shuffle option tick box” when making the galleries… if by any chance it could be part of a future update of Flashlight !




    Hey alexthefunk,

    Let me tag this to Kriesi.



Viewing 25 posts - 1 through 25 (of 25 total)

The topic ‘Random photo’ is closed to new replies.