Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #248684

    Hi,
    I’ve searched your forum and found a couple of posts relating to this but nothing has worked.
    I am using a portfolio grid on numerous pages. I would like these to display portfolio items randomly. Currently it shows them in the order that is in the back-end.
    I tried this code in my functions file but this did not work:
    <?
    function custom_post_grid_query( $query, $params ) {
    $query['orderby'] = ‘rand’;
    return $query;
    }
    add_filter( ‘avia_post_grid_query’, ‘custom_post_grid_query’, 10, 2);
    ?>

    Thanks very much :)

    #249060

    Hi!

    That should definitely work, is that code put at the very beginning of the file? try putting it at the bottom instead (and without the PHP opener symbol).

    Best regards,
    Josue

    #281024

    Thanks I had a plugin that was interfering with this.

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

The topic ‘randomise portfolio item grid’ is closed to new replies.