Search page setup

Hi Any advice on what is best practice for creating the search page template/results page?

I understand we can create a search page template using the Cwicly themer.
This is used to display search results using the standard WP Search block.

It appears to be working correctly.

Looking at the backend files in the Cpanel, there doesn’t appear to be the file ‘search.html’ in the Cwicly Template folder. I assume it’s not needed there as it is working and it is handled by the Cwicly Themer.

What is the best approach for search using standard WP search block?

Option 1:
Create a search icon in the menu that triggers a modal with the WP search block > goes to default wordpress search results page (the template created in the Cwicly Themer)
URL: ?s=search-term

Option 2:
Create a link in the menu (has search icon) > link takes you to a standard page named ‘Search’.
On this page is a title, WP Search block, and relevant content.
Using the WP Search block on this page then takes you to the search results template
URL: ?s=search-term

I’ve been playing around with the new mega nav menu.
The Search block could be added to the drop down area so that could remove the need for the modal approach.



first option seems most logical but do you know more about how to set up the search results page? i don’t know what to do in order to show the resulting found pages correctly under each other or in a grid or something

@boris You can customise the “Search Results” Template via the Themer and add a Cwicly Query block in there with “Inherit query from URL” enabled.

amazing. I’ve managed to do that.

But would you also know how to show a text excerpt of the part where the search term is found on a given post/page?

would be great if i could show it below the title of the page on which the search term is found

and also: does anyone know how to show a fallback text saying ‘nothing found’ if the query doesn’t input any post/page?

This is more complex, there is a way and I may make a tip for this in future but don’t have the time right now.

You can simply show the excerpt by adding a Paragraph block inside your query template under the Heading block and using the Dynamic Content button to show the Post Excerpt for the Current Post.

This post provides a nice way to do it using the Has Items visibility condition:

1 Like