- This topic has 3 replies, 2 voices, and was last updated 8 years, 2 months ago by
Tom.
-
AuthorPosts
-
January 11, 2018 at 8:08 am #468466
verysiberian
Hello! First, let me express how much I am enjoying GeneratePress and GP Premium. Thank you for such useful and powerful tools. I have found answers to all of my questions in the documentation thus far. There is only one matter about which I am perplexed.
I use a non-native WordPress search service, AddSearch, for searches on two of my sites. They provide a plugin that overrides the native WP search function such that when someone performs a search using the search widget, their service is triggered instead of a standard WP search. This works as expected using the GeneratePress theme. However, I have found that when navigation search is enabled in GeneratePress that clicking on the magnifying glass icon still uses a standard WP search and leads to a results page. Doing so also causes a search box to appear in an odd part of the page (lower left corner of screen).
I would appreciate any suggestions for having a click on the navigation search icon leading to an AddSearch search rather than the native WP search. This is the only conflict between that plugin/service (AddSearch) and GeneratePress that I have thus far detected. Thank you for any assistance!
January 11, 2018 at 9:57 am #468545Tom
Lead DeveloperLead DeveloperHi there,
Glad you’re enjoying GP!
The only thing I see is that service is adding a data attribute to the search box at the bottom of the site.
We can add that data attribute to the navigation search using a filter: https://docs.generatepress.com/article/generate_navigation_search_output/
For example:
add_filter( 'generate_navigation_search_output', 'tu_navigation_search_data_attribute' ); function tu_navigation_search_data_attribute() { printf( '<form method="get" class="search-form navigation-search" action="%1$s"> <input type="search" data-addsearch-field="true" class="search-field" value="%2$s" name="s" title="%3$s" /> </form>', esc_url( home_url( '/' ) ), esc_attr( get_search_query() ), esc_attr_x( 'Search', 'label', 'generatepress' ) ); }January 11, 2018 at 10:03 am #468551verysiberian
Thank you very much, Tom! Works perfectly. 🙂
January 11, 2018 at 1:27 pm #468714Tom
Lead DeveloperLead DeveloperYou’re very welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.