- This topic has 5 replies, 3 voices, and was last updated 4 months, 3 weeks ago by
Leo.
-
AuthorPosts
-
October 5, 2020 at 5:11 am #1472851
Grant
Hello,
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:
https://iafrika.org/search_gcse/?q=onetwothree
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 #1473405Leo
StaffCustomer SupportHi there,
That’s not something the theme controls.
I assume it’s using a plugin? If so you will need to check with the plugin support.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 5, 2020 at 11:50 pm #1474060Grant
Hi Leo,
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 #1474114David
StaffCustomer SupportHi there,
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:
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 6, 2020 at 8:14 am #1474824Grant
Hi David,
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?
Thanks,
Grant
October 6, 2020 at 9:00 am #1474890Leo
StaffCustomer SupportUnfortunately there is no filter for that so a child theme is required.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.