Hi everyone.
I’ve got soft reject for WP with this comment:
1. Add your search forms using https://developer.wordpress.org/reference/functions/get_search_form/ function instead of hard-coding the form.
I understand that I can use searchform.php to pull the form from there. But I have few different forms in a theme. They all have different classes. For example I have navigation form with .nav-search class and mobile form with .nav-mobile-search class. How to achieve it?
Hi,
use filter get_search_form
here is simple example https://bitbucket.org/snippets/drinkmaker/jeqza4
1 Like
This will generate one search form. But I need 2 with different classes. So I can use them in different locations. I guess it can be achieved with a function args. Something like:
get_search_form( first_form );
get_search_form( second_form );
You can use the conditions inside the function https://bitbucket.org/snippets/drinkmaker/peqxnn
Or use global variable.
1 Like