I know that this question is asked numerous but i din't find an answer that suits to me.
Well i'm made some custom post types and some custom taxonomies. I have the custom post type Products and linked to it the taxonomy Product Categories. When the user is at the Products page and clicks on a Product Category, i want to show him all the products from this specific category.
The problem is that the product categories will be about 50. Right now the only thing that i found is to put to the wordpress loop this
<?php $loop = new WP_Query( array( 'post_type' => 'all_products', 'posts_per_page' => 12, 'products' => 'advance' ) ); ?>
But this shows the posts only for the advance category. I need a way to automatically takes the category that the user clicked. The dirty way is to make 50 taxonomy-{slug}.php files. But i want the clean way. And i can't seem to find it.
I read all the codex about the template hierarchy and specific for the custom taxonomies, and search the half stackexchange but nothing (maybe i've missed something :P ).
I tried to describe my question as clear as i can. If you cant understand something just tell me and i'll try to update the question with more info.
Thank you
pre_get_posts
to change yourposts_per_page
'products' => 'advance'
?