I am looking for a way to present search results in my custom wordpress theme.
I was hoping being able to present the results like this:
Displaying 4 search results for “test”
Pages
- testpage 1
- testpage 2
Posts
- testpost 1
- testpost 2
I wrote a function is_type_page that I can use inside the loop (2 loops), but this breaks the pagination functionality.
Any suggestions how to achieve this?
I would run 2 separate loops on the page, after the first loop for pages run rewind_posts() and then run the loop again. Also the key to pagination is making sure the global $paged variable is being picked up on by both loops. $paged is how wordpress separates posts into pages. i.e. if you go to page 2 of something then the global $paged = 2.
Hope that helps
Multiple loops using rewind_posts here