I try to create a custom search result template but how to properly output the search results…
Use a query loop like you would if creating an archive page, leave the default query settings. Then use the template conditions (in the template settings) to make sure the template applies to ‘search results’.
I added this in a code block on my search results template to show the terms the user was looking for. Maybe useful for somebody.
Cheers
Patric
<?php
echo '<h4 class="title">' . esc_html__( 'Search results for: "', 'bricks' ) . get_search_query() .'"</h4>';
?>
How might one include the post categories in the search results…for example, if I have one post in a category named “cat” but for some reason, the post doesn’t include the word “cat” it won’t be found…I’ve tried adding a Taxonomy Query on the same loop that is showing the posts, but there are no additional results shown for posts that match the term. How might I approach this?
For anyone else having issues with this. I am using relevanssi to handle search. The above only worked when I changed the order by to “none”