1

I want to give users the ability to refine their results in the category section. Like if the user is in the "car" category section in there he can then refine the "search" by color, number of wheels, etc tags. Is this possible without messing up all the pagination logic, etc of the category.php page? Sort of like turning the category.php into a search page. Also not looking for sub categories but rather the ability to add multiple tags to refine the results.

1 Answer 1

-2

This is an old plugin, but I think you will get idea from this plugin

Similar thing is possible with this plugin, you will find more details in plugin description.

Alternatively you can use "pre_get_posts" action in your theme's functions.php file to call only on category archive page using below code. Below code will add filter on the category.php page to fetch posts with tag 'red'.

function tag_filter_category( $query ) {
if ( is_category() ) {
   $query->set( 'tag', 'red' ); // to fetch posts with tag red (color)
  }
}
add_action( 'pre_get_posts', 'tag_filter_category' );
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.