After hours of searching for solution… this one nails it.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
function listNumOveride($query_string) { if ( !is_admin() ){ if ( isset( $query_string['category_name'] ) ) { $cats = explode("/",$query_string['category_name']); $root = $cats[0]; //root category $current = $cats[count($cats)-1]; //current category if ($current == "mobile-phone") $query_string['posts_per_page'] = 6; else if ($root == "gadgets") $query_string['posts_per_page'] = 10; } } return $query_string; } add_action( 'request', 'listNumOveride' ); |
Source: WordPress.org