Skip to content

Instantly share code, notes, and snippets.

@gspearce
Created October 15, 2013 21:55
Show Gist options
  • Select an option

  • Save gspearce/6999254 to your computer and use it in GitHub Desktop.

Select an option

Save gspearce/6999254 to your computer and use it in GitHub Desktop.
WooCommerce snippet to create a view all products option for every category or search result page.
<?php
/* Don't forget to remove the opening and closing PHP tags */
if( isset( $_GET['show_all'] ) ){
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return -1;' ) );
} else {
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 10;' ) );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment