How to Search Multiple Custom Post Types and Style Each Post Type Result Differently

This will allow you to search Custom Post Types in addition to regular posts and allow you to show the results differently dependent on post type.

First put a filter in your theme’s function.php file that will group the results by post type.

Next, pull open your theme’s search.php file and tackle the following code. This example will separate your Blog “post” Blog Post type, and your “product” Products post type.

Leave a Reply

Your email address will not be published. Required fields are marked *

30 + = 39