- This topic has 5 replies, 3 voices, and was last updated 1 year ago by Leo.
October 5, 2020 at 5:11 am #1472851Grant
I would like to add a custom message and embed a Google form to the search results page when the keyword returns no results. Here is an example:
So, if you search for “onetwothree” (or something else that isn’t in the content), it should not have the generic ‘no results’ response:
“Sorry, but nothing matched your search terms. Please try again with some different keywords.”
Rather, it should have a custom message and the Google Form into which uses can write what they were looking for (but did not find).
What is the best way of doing this please?October 5, 2020 at 9:48 am #1473405LeoStaffCustomer SupportOctober 5, 2020 at 11:50 pm #1474060Grant
Yes, it is using Relevanssi but that leverages off the standard WordPress search, which produces this message:
Sorry, but nothing matched your search terms. Please try again with some different keywords.
The plugin owner says:
You need to modify the search results template from your theme, that’s where that message is coming from. There are few different variations on how themes do this, but the most common way is the search.php file – look for that in your theme.
So, please could you tell me how to do this with GeneratePress and to add in the Google Form? Perhaps with a code snippet? I have the Code Snippets plugin installed.October 6, 2020 at 12:53 am #1474114DavidStaffCustomer Support
you would need to make a duplicate of the no-results.php in your child theme and make your changes there. I have highlighted the part that needs changing:October 6, 2020 at 8:14 am #1474824Grant
Thanks, I have edited the standard no-results.php and it works. I understand that a child theme is a better option for this as this file will be replaced next time the software is updated. But is it the only solution as I am running a multisite installation and will have to create a new child for each sub-domain? Is there no option to do this with code snippets or something else?
GrantOctober 6, 2020 at 9:00 am #1474890
- You must be logged in to reply to this topic.