Search results sorted by post types
Hello, I am working on a site with several post types – 4 to be exact – and I am trying to setup the search results page to have a filter/sort the results by post types.
For example, when a person searches a term they are taking to the page with the results, all posts found from all post types are shown but up top there are the different post types name links that will sort the results and show only the respective post type’s post. Right now I have several loops on the search results page for each post type but when I test it, the loops are all showing the same results even though each loop has a query for a different post type.
How do I fix the loop so that it only shows the search results from that post type? I dont want to have different search forms or reset the query and end up losing the search term. Here is some of the code from the page — http://pastebin.com/L9zEw1cn
The first loop is the default loop which will show all the results and the second loop is the loop I am trying to use for the rest of the post types.
So is there anyway to fix the second loop so that it only shows the search results for that post type?
Any help would be greatly appreciated. Thanks.
- The topic ‘Search results sorted by post types’ is closed to new replies.