Custom product per page
-
Hello All,
This plugin is working great on my website, however I want to be able to control the product per page even more than I can see.
I have a “view all” button below the pagination and the code in my files is as follows:
add_filter( ‘loop_shop_per_page’, ‘new_loop_shop_per_page’, 20 );
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options –> Reading
// Return the number of products you wanna show per page.
if (isset($_REQUEST[‘showall’])) {
$cols = -1;
}
else { $cols = 36; }
return $cols;
}I am using the plugin inside a product tab (the 2nd tab) on the product page. The problem is when I click view all it refreshes the page, and adds ‘?showall=1’ to the url, but still only shows 36 products.
The view all does work on the actual shop page.
Any help would be greatly appreciated.
Thanks
- The topic ‘Custom product per page’ is closed to new replies.