- This topic has 11 replies, 4 voices, and was last updated 1 year, 1 month ago by
David.
-
AuthorPosts
-
October 3, 2018 at 10:16 am #692691
Daniel
Hello GP.Team,
I wonder if there’s a way to implement this without changing the searchresults template?
https://www.relevanssi.com/knowledge-base/did-you-mean-suggestions/Best, Daniel
GeneratePress 2.1.4GP Premium 1.7.2October 3, 2018 at 8:51 pm #692977Leo
StaffCustomer SupportHi there,
Not 100% sure what you mean but looks like this feature is listed under the Advanced Feature of their plugin.
https://en-ca.wordpress.org/plugins/relevanssi/Let me know this helps ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 3, 2018 at 11:42 pm #693041Daniel
Hi Leo,
in their documentation they say, that I have to put some custom code in my searchtemplate.
When I update GP these changes are lost, I think. My question is, if I can add this anyway in a way, that I don’t lose it?
Best, Daniel
October 4, 2018 at 9:28 am #693497Leo
StaffCustomer SupportDid you make the changes in the theme’s core files?
If so it will be lost during updates.
Try copy the entire file into a child theme then make changes there:
https://docs.generatepress.com/article/using-child-theme/Let me know if this helps ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 6, 2018 at 11:37 am #720662xdaniel
No, I hoped there could be a snippet for the functions.php, which I can add into code snippets.
November 6, 2018 at 4:06 pm #720813Leo
StaffCustomer SupportHmm you’d have to ask them about that.
Their instruction doesn’t seem to suggest so.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 27, 2021 at 4:20 am #1711758Marcus
Just to close the topic, because I was also looking for it …
The PHP code for the function mentioned above can either be added to the search via Elements or directly in the search.php (what I rather recommend) but then via a child theme.
maybe this will be of use to someone.
March 27, 2021 at 9:47 am #1712239Leo
StaffCustomer SupportThanks for sharing!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 27, 2021 at 10:45 am #1712309xdaniel
Hi Marcus,
could you explain me the way to do it by elements?
Best, DanielMarch 28, 2021 at 2:53 am #1712653David
StaffCustomer SupportHi there,
I am not sure where you want to place it on the search results, but you can try:
1. Create a new Hook Element.
2. Add your code:<?php if ( function_exists( 'relevanssi_didyoumean' ) ) { relevanssi_didyoumean( get_search_query( false ), '<p>Did you mean: ', '</p>', 5 ); } ?>
3. Select the
generate_before_main_content
hook
4. Check execute PHP
5. Set the Display Rules to: Search Results.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 28, 2021 at 3:42 am #1712695xdaniel
Thank you David. That worked very well!
March 28, 2021 at 4:55 am #1712731David
StaffCustomer SupportGlad to hear that!
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.