• Resolved e_tres

    (@e_tres)


    Hello
    I am working with the Zilla Portfolio Plugin and the Base Theme (also from Zilla), and I would like to sort my portfolio posts randomly. How Should I proceed?

    I tried adding code to the functions.php file, but none of the codes I got from the internet achieved that kind of sorting.

    Thank you so mucho for all your work and your answers!

    https://wordpress.org/plugins/zillaportfolio/

Viewing 1 replies (of 1 total)
  • Plugin Author marksouthard

    (@mbsatunc)

    You could add something like this to your functions file:

    if( ! function_exists( 'set_portfolio_order' ) ) :
    /**
     * Set the order for portfolio
     *
     * @param  obj $query the query object
     * @return void
     */
    function set_portfolio_order($query) {
    	if ( $query->is_page_template( 'template-portfolio.php' ) && $query->is_main_query() ) {
            $query->set( 'orderby', 'rand' );
        }
    }
    endif;
    add_action('pre_get_posts', 'set_portfolio_order');
Viewing 1 replies (of 1 total)
  • The topic ‘Portfolio posts random order?’ is closed to new replies.