Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #194603

    Hi There,

    I was slowly adding some test content into the theme and realise that it only display the Most Recent portfolio items, is there a way to display Random items that Exclude the current post item? Thanks!

    Regards,
    Robert Chai

    #194647

    Hi sgrobert!

    You can change the order of the portfolio using this on 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);

    Best regards,
    Ismael

    #194655

    Hi Ismael,

    So meaning I can’t do it through the Advanced Editor rather than through the Default Editor? In this case, I can’t edit the settings of the Post Grid though, do let me know if there is an alternative?

    Regards,
    Robert Chai

    #194683

    Hi!

    You can do it on the Advance Layout Builder. It will sort the portfolio items on random order. Please try it.

    Cheers!
    Ismael

    #194706

    Hi Ismael,

    So may I just clarify that if I insert the above code, it will by default auto-random the default grid? Please do let me know. Thanks!

    Regards,
    Robert Chai

    #194707

    Hi Ismael,

    I’ve just tried and tested. Does looks like it works without additional codes. Thanks so much!

    Regards,
    Robert Chai

    #194747

    Hi Ismael,

    I realized that I do need the two types of sorting working on the same website, meaning RANDOM and MOST RECENT. Thus, would there be an alternative to have the choice of calling up either or within the Advanced Editor? Thanks.

    Regards,
    Robert Chai

    #195378

    Hey!

    No, unfortunately not as far as I know. The filter adds the random to the query for all queries so for right now since there isn’t a theme option available its either an all or nothing change.

    I’ll add the idea for a future update for a random option within the shortcode options however.

    Cheers!
    Devin

    #221778

    +1 for a random option ;)

    Torsten

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Can the Portfolio Grid display a list of Random items instead of Recent items?’ is closed to new replies.