-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Filters and Hooks to Search Form Widget #5598
Comments
Can I add a request to this? Generally speaking, I would like to just have the ability to set an ACTION for the form. Seems like that would be easy enough to do; I don't necessarily want to mess around with hooks and such, and it would be just so much simpler if I could set the action to be my desired URL. I get that it would be useful to have hooks and such (and I think there is one) but in my situation I don't want to deal with Ajax. So, let me choose the METHOD and ACTION as one of the settings of the form. Thanks! |
I hope I can add this request here In the basic form search, instead of using the default search form, I used dropdowns from the form field as search options but they don't work, the explore page still displays all the listings |
Can't support this enough. Search is major functionality, I would heavily appreciate this being worked on. If anyone has an adequate solution in the mean time, such as a plugin that has decent search functionality, fast and elementor compatible that would be great. I've tried and failed to implement external search plugins into elementor, so any assistance is greatly appreciated. |
So as of now there is no way of achieving this? I'm essentially trying to make the Elementor Search box use it only for Products/WooCommerce since its an ecommerce website, and it doesnt make sense for the search platform to search for anything else. I built the header with Elementor, and it's inconsistent that the search box there returns different results with a different visual organization than the Woocommerce search bars I was told to: This is common in some custom templates. To fix this, just add this code inside the form that contains the input box :
The final form should look something like this:
But I assume there is no way to actually do this right now |
What I have done is just basically copied your Code inside a Popup with an HTML Widget. Then I have created a search icon and linked it with the Popup. Now I have nearly the same effect as when I use the search widget (Fullscreen), but as product search! |
Yes, Everything else is so perfect. Custom Post Types, Custom Fields, easily create these ACF templates and listings, but NO filtering what so ever. I've also tried https://crocoblock.com/jetsmartfilters/, but it requires you to setup the whole system (post types and custom fields) through their JetEngine plugin and it makes it bugs a lot and makes it slow. Elementor doesn't bug, it works so well, same with CPT UI and ACF, so I wouldn't like to mix the Jet plugin into the mess just to get a simple filtering for my posts. Such a critical component, can't be too hard to create I would imagine. Please implement this and you are golden! |
This should also be high up on Elementors list (along with custom skins for posts). Filtering should be built into posts as well as woocommerce products. |
Are you guys reading what J3nsis wrote? The code posted works. |
Where do we paste this code? |
In my archive template for a CPT called Reviews, I used elementor to insert an HTML block and inserted the code below. It's slightly different than the original but more to my liking. Cheers, Richard
|
The ability to exclude pages like the cart page and my account page would be a massive improvement for this element |
This issue has been resolved in Elementor Pro v2.7 Feel free to update Thanks! |
Hi where are the documentation and how to use: elementor_pro/search_form/after_input and elementor_pro/search_form/before_input actions hooks? I also need to add data-swplive="true" to the input field markup. Thanks |
@pako69 If you need to force Elementor's search to only use a specific post type, lets say product for woocommerce, you can put this into a
But if you wanted to add your extra data attribute, you might have to add a second imput that mimics the input, then use css to hide the previous one.
|
Hi @yratof I waited a month to get an answer, but it was worth it! ;-) It works and here my PHP/CSS code for other people: PHP:
CSS:
Thank you so much! |
The search form shows up well as does the AJAX live search results. HOWEVER, the input is not submitting when I hit the enter button. Do you know why? I'm probably missing something simple but I don't know. |
Found a solution with add_render_attribute()! Add to functions.php:
Relevant link: https://developers.elementor.com/add-html-attribute/. This modifies the original template so the form input itself has a data attribute so there's no need for any CSS. My best guess at the above problem (search form not submitting when hit enter) was that Wordpress was confused by 2 search forms. |
Thanks for the code, it works perfectly! |
Thank you for the code. |
how can I change the results page? i mean when I search on elementor search form it takes me to https://domain.com/?s=searchterm I would like to get results as https://domain.com/search-results/?ad_title=searchterm please can you share the code add to my functions.php ? |
Prerequisites
My Feature Request
Make Elementor Pro Search Form Widget customizeable via Filters and Hooks (aka more developer friendly)
I need the Elementor search form widget to be more customizeable - preferable via Filters and Hooks. This also will open possibilities for plugin and theme developers.
My Suggestions
<form>
tag, plus, Add Action hook before closing</form>
tag --> both will allow to add additional markup like hidden input fields etc.Considered Alternatives
As of my knowledge there is no native Elementor widget yet which would allow the above mentioned features.
I considered this plugin: https://wordpress.org/plugins/searchwp-live-ajax-search/
However, it cannot be added to Elementor yet as I cannot customize the search form/ input field etc.
There needs to be added this part to the input field markup:
data-swplive="true"
Other "live search" plugins may work via a regular WordPress widget or a shortcode BUT most of them are non-working, bloated AND slowing the site down - or all of that combined.... :-(
Another alternative would be to enhance the existing Elementor search widget with lot more capabilities and customizing options also for developers. But the above made suggestions then would still apply in my opinion.
Additional context
(currently none)
The text was updated successfully, but these errors were encountered: