Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #185324

    Is it possible to have random images from the categories selected in either the Masonry full width or portfolio grid?

    I wanted the front page of my website to have random member images displayed from several hundred and don’t want the same ones at the front every time.

    #185377

    Hey rodpascoe!

    Try with this, open this file /config-templatebuilder/avia-shortcodes/masonry_entries.php:

    Replace this line (287):
    $query = array( 'orderby' => 'date',

    By this:
    $query = array( 'orderby' => 'rand',

    Cheers!
    Josue

    • This reply was modified 11 years ago by Josue.
    #189644

    Hi!
    I got the same issue, would like to get random thumbs on my Portfolio grid.
    But the solution above doesn´t seem to work for me? Any other ideias?

    Thanks, best regards

    #189656

    Hi!

    That will work only if you are using the masonry element, for the grid element you’d need to change this file /config-templatebuilder/avia-shortcodes/postslider.php, line 458.

    Cheers!
    Josue

    #189732
    This reply has been marked as private.
    #190534

    Hi!

    Try to insert following code at the bottom of functions.php

    
    function custom_post_grid_query( $query, $params ) {
    $query['orderby'] = 'rand';
    return $query;
    }
    add_filter( 'avia_post_grid_query', 'custom_post_grid_query', 10, 2);
    

    If it still doesn’t work try to deactivate all third party plugins – maybe a plugin hooks into the query and changes the order.

    Regards,
    Peter

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Random images’ is closed to new replies.