Okay
  Public Ticket #1588871
potfolio order
Closed

Comments

  •  1
    KotaroA started the conversation

    Hi team,

    I just setting up my new portfolio page and I want the portfolio order be random on every new load. Can you help me with that? 

    Thanks, 
    Kotaro

  • [deleted] replied

    Hi Kotaro,

    If you want to randomize the order of projects add this code in functions.php

    function kalium_portfolio_query_random_order( $args ) {    $args['orderby'] = 'rand';    return $args;
    }
    add_filter( 'kalium_portfolio_query', 'kalium_portfolio_query_random_order' );

    If the portfolio projects are showing in homepage and other pages as well, you can apply random order on homepage only with this improved code:

    function kalium_portfolio_query_random_order( $args ) {    if ( is_front_page() ) {        $args['orderby'] = 'rand';    }    return $args;
    }
    add_filter( 'kalium_portfolio_query', 'kalium_portfolio_query_random_order' );

    This should work for you.

    Thank you.

  •  1
    KotaroA replied

    Thank you Eroll. It worked perfectly to my homepage:)


    Best,

    Kotaro

  • [deleted] replied

    Hi there,

    I'm glad to hear that

    P.S: If you like our theme, it would help us a lot if you could give us a five-star rating on Themeforest from your Downloads tab.  

    A huge thank you from Laborator in advance and have a great week!

    Will set this ticket as solved from here.

    Thank you.