Randomizing Photo Gallery

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #11488
    tsubasa_gaki
    Member

    Is it possible to have photos to be shown randomly when using photo galleries? If so, how?
    Thank you.

    #11498
    Veena
    Moderator

    Pls modify the file gallery-functions.php(framework/functions/gallery-functions.php) line no:13 as below –

     $query_args = array('post_type' => 'gallery_item', 'posts_per_page' => $args['posts_per_page'], 'filterable' => $args['filterable'],'orderby' => 'rand', 'paged' => $paged);
    
    #11513
    tsubasa_gaki
    Member

    Hi!
    I’ve modified the code as above but there were no changes. Here’s the link to the website I’m working on http://naitsa.ca/topmodel/. Should I change or add anything else? Thanks.

    #11537
    Veena
    Moderator

    Can you pls mention which shortcode is using there to display gallery items?
    The above mentioned changes will work on gallery page.For shortcodes we need to make changes in a different file.

    #11541
    tsubasa_gaki
    Member

    This is the code I’m using on the page section:

    [show_gallery number_of_columns=”4″ post_count=”12″ image_size=”medium” filterable=”false” no_margin=”true”]

    #11559
    Veena
    Moderator

    Pls modify file gallery-functions.php(framework/functions/gallery-functions.php) line no:143 as below –

    $loop = new WP_Query(array('post_type' => 'gallery_item', 'posts_per_page' => $posts_per_page, 'orderby' => 'rand'));
    
    #11562
    tsubasa_gaki
    Member

    Still not working. Is there anything I can do? I have also noticed the gallery isn’t opening as lightbox, just linking to the images. Can we fix that too? Thank you.

    #11567
    Veena
    Moderator

    It should work, before i have tested the code in my installation.
    Kindly share FTP login credentials, We will check once.

    #11824
    tsubasa_gaki
    Member
    This reply has been marked as private.
    #11838
    Veena
    Moderator
    This reply has been marked as private.
    #11852
    tsubasa_gaki
    Member
    This reply has been marked as private.
    #11862
    Veena
    Moderator

    Strange, On checking your code is perfect but i failed to understand why it is so.
    Could you pls share a temporary login to your site as a private reply ?

    #11876
    tsubasa_gaki
    Member
    This reply has been marked as private.
    #11910
    Veena
    Moderator

    In your Wp Engine site they have disabled Rand function , now we have enabled the same in Wp Engine Advanced Configuration and everything is working fine now.
    You can take a look in this link-
    https://wordpress.org/support/topic/wp_query-orderby-random-not-working

    Also we have unchecked “DISABLE HOVER ON GALLERY” option in themeoptions > Gallerypage for lightbox to work.

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Randomizing Photo Gallery’ is closed to new replies.