• Hi, I use this code to sort the products randomly:

    session_start();
    
    add_filter( 'posts_orderby', 'misha_rand_order_with_seed' );
     
    function misha_rand_order_with_seed( $orderby_statement ){
    
        if( !is_shop() && !is_product_category() ) return $orderby_statement;
    
        $seed = $_SESSION['seed'];
        if (empty($seed)) {
          $seed = rand();
          $_SESSION['seed'] = $seed;
        }
    
        $orderby_statement = 'RAND('.$seed.')';
        return $orderby_statement;
    }

    how can I make sure that the row of products located right above the footer is not affected by it? I mean the 6 squares at the bottom of the page, it’s a Portfolio widget from the Elementor plugin. Thank you.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘posts_orderby exclude section from sorting’ is closed to new replies.