I am trying to display only one product of a child category in the page of parent category. If I use $query->set( 'posts_per_page', '1' ); it shows only only 1 post , which is near to what i want but it takes the other child category products to next pages which is not what I want.. to explain more. I have 1 parent Cat e.g Play station Store, in that store - 3 Child with 1st child-products like $10, 2nd child - $25 etc. Now I want parent cat page to show all child but only 1 post at a time ..

I would like the add a function in child theme functions file this is all I am able to do yet .. function bt_shop_filter_cat($query) { if (!is_admin() && $query->is_main_query() && is_product_category( array('playstation-store')) ) { // change to your product category $query->set( 'posts_per_page', '1' ); }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.