Wp Pagenavi how to display all results

I replaced it with:

$out .= $instance->get_single( 1, 'first', "All", 100, 1 );

And I changed the get_single function, more exactly I added a parameter, “all”, and this one won’t afect anything else.

function get_single( $page, $class, $raw_text, $format="%PAGE_NUMBER%", $all = 0 ) {
    if ( empty( $raw_text ) )
        return '';

    $text = str_replace( $format, number_format_i18n( $page ), $raw_text );
            if($all == 1) return "<a href="" . esc_url( $this->get_url( $page ) ) . "?all-products=1" class="$class">$text</a>";
    else return "<a href="" . esc_url( $this->get_url( $page ) ) . "" class="$class">$text</a>";
}

Finally, I added this to the end of the functions.php file:

if(isset($_GET['all-products'])) 
   add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 100;' ), 20 );

In my case, when the button “All” is pressed, the website will display the first page of the category, with 100 products. You should change 100 to your desired number.

I believe it’s not the best solution for this problem, but it’s certainly working for me.