Crosswinds Blocks – Post Type Search Results

  1. Home
  2. Article
  3. Crosswinds Blocks – Post Type Search Results

The Post Type Search Results block allows you to display different queries and post templates based on what post type is being searched.

To get started, go to your search template and replace the query loop block that’s there with the Post Type Search Results block.

Inside the block, hit the plus icon to add a Single Post Type Search Results block and select what post type this is for.

When you add that block it will automatically add a query loop block inside of it. Make sure that the query loop has the “inherit query” option selected as true.

Then you can customize the post template block inside how you want it to look for that post type. For example, if you’re creating one for a projects post type, you can display the project categories instead of the regular categories.

Make sure to add a Single Post Type Search Results block as well as one that has the “All Post Types” option selected as a catch all in case the post_type parameter isn’t set in the URL.

When you’re done, hit the save button to make your changes live.

Tags: