Created
August 15, 2012 09:32
-
-
Save mikejolley/3358102 to your computer and use it in GitHub Desktop.
WooCommerce - Change products per page conditionally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'pre_get_posts', 'mj_change_per_page' ); | |
function mj_change_per_page() { | |
if ( is_product_category( 'games' ) ) { | |
add_filter('loop_shop_per_page', create_function('$cols', 'return 1;') ); | |
} else { | |
add_filter('loop_shop_per_page', create_function('$cols', 'return 8;') ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Mike, there is a way to do this in the front end, with a dropdown?