- This topic has 24 replies, 5 voices, and was last updated 8 years, 9 months ago by Tom.
-
AuthorPosts
-
December 4, 2014 at 5:48 pm #51334Robyn Williams
Hey there! Loving the theme – I’m currently working on a WooCommerce site and have implemented a custom GeneratePress child theme.
I love the search button in the main navigation bar – however, it searches ALL posts, pages AND products. I would just like it to search products only.
I’ve done some research in the WordPress support forms, but haven’t found exactly what I need yet. (Perhaps I’m looking in the wrong place…) I’m currently looking at the GP theme’s searchform.php file to see if anything looks familiar.
I would greatly appreciate any help. Thanks so much!
December 5, 2014 at 12:56 am #51405TomLead DeveloperLead DeveloperHi Robyn,
Let me look into this – I’ll try and provide a solution for you in the morning.
Thanks!
December 5, 2014 at 12:57 pm #51654TomLead DeveloperLead DeveloperAlright, here’s the solution π
add_filter( 'generate_navigation_search_output', 'tu_wc_navigation_search' ); function tu_wc_navigation_search() { printf( '<form method="get" class="search-form navigation-search" action="%1$s"> <input type="search" class="search-field" value="%2$s" name="s" title="%2$s"> <input type="hidden" name="post_type" value="product"> </form>', esc_url( home_url( '/' ) ), esc_attr( get_search_query() ), esc_attr_x( 'Search', 'label', 'generatepress' ) ); }
Hope this helps π
December 5, 2014 at 1:15 pm #51659Robyn WilliamsIt worked!!
Tom, you are so awesome. Thanks so much for the help and the quick response!
January 28, 2015 at 3:09 pm #69706Kris TengbergHello Tom,
I am enjoying the GeneratePress Theme and the Add-Ons immensely! You have my endless gratitude and praise. And I am equally pleased by the Tutorials and Support you offer.
I hope this piggyback post is not too far off the subject under discussion. I despise Topic Drift as much as I do Excess Thread Starting. π
Request:
I would also like to remove Search from the main Navigation bar, but not replace it.Where is the code and what exactly do I delete (or comment out because you never know…) to remove the Default Search function from the Nav bar only?
I would still like to use the sidebar Search widget.
Thank you,
Kris
January 28, 2015 at 3:24 pm #69707Kris TengbergHello again Tom,
Please disregard the questions and keep the praise. π
I don’t know how I kept missing the selection in the Layout part of the Customization menu.
Glad for that great Knowledgebase!Thank you,
Kris
January 28, 2015 at 10:04 pm #69754TomLead DeveloperLead DeveloperHi Kris,
Glad you found the option!
For others, the option is in “Appearance > Customize > Layout”.
Thanks!
October 1, 2015 at 9:58 pm #141333RylanI have an additional request! Can you make the search box appear UNDER the navigation instead of over of it. It’s mighty confusing and crowded when you can see menu text and menu image under the search text. Also maybe a button to search so if people don’t know to push enter, there is another option. But i think my first request is vital!
Thanks,
Rylan
October 1, 2015 at 11:57 pm #141345TomLead DeveloperLead DeveloperHi Rylan,
You can make it appear below with this CSS (compatible with the sticky menu add-on):
.main-navigation:not(.navigation-clone) .navigation-search { top: 60px; }
60px is the height of your menu items (this can be adjusted if you’ve changed it).
Adding a button is a bit harder, but I may add a placeholder explaining to type your search and hit enter or something in the near future π
December 14, 2015 at 11:40 am #160001PatrickHey there,
my website is growing and I really enjoy working with GP. But I got to a point where I am lost now. I try to change the text of the search function from “Search…” to “Suche…” (German translation). So far I tried to modify the searchform.php and search.php in the template folder but nothing worked so far.
When I rename searchform.php to old.searchform.php I get the german version with “Suchen…”?
Can you help me, please? π
December 14, 2015 at 7:05 pm #160066TomLead DeveloperLead DeveloperAre you using a child theme with a searchform.php file or are you using the function above?
December 15, 2015 at 10:21 am #160198PatrickI am not sure but I don’t think that I am using a child theme – at least there is none active :-/
December 15, 2015 at 10:39 pm #160324TomLead DeveloperLead DeveloperBy default, that text should already be translated to German.
I just tested it on my testing site and it was indeed translated?
Are you aware of any custom functions you’ve added if you don’t have a child theme?
December 17, 2015 at 12:21 pm #160702PatrickNot really, no. But I renamed searchform.php to old.searchform.php and now I have the german translation…
December 17, 2015 at 6:48 pm #160806TomLead DeveloperLead DeveloperYou renamed searchform.php in the main “wp-content/themes/generatepress” folder?
-
AuthorPosts
- You must be logged in to reply to this topic.