Modify search form in wordpress -


I am new to WordPress.

I've modified the search form in WordPress. & lt; Form class = "form-inline" role = "form" method = "get" class = "search-form" action = "& lt ;? php echo home_url ('/');? & Gt;" & gt; & Lt; div class = "form-group" & gt; & Lt; Input type = "search" class = "form-control" placeholder = "type your search" value = "" name = "query" /> & Lt; / Div & gt; & Lt; Button type = "submit" class = "btn btn-default" & gt; Search & lt; / Button & gt; & Lt; / Form & gt;

In this form I have modified the attribute of the search name name = 's' to name = 'query'.

But after that search is not working

Do I have to type anything in function.php to get a query string.

Try this code, I hope this will help you to work out,

Add it to the fuctions.php file of the theme: -

  add_filter ('Query_vars', 'my_query_vars'); Function my_query_vars ($ query_vars) {if (isset ($ _GET ['query']) & amp; below ($ _GET ['query']) {$ _GET ['s'] = $ _GET ['query'];} $ Query_vars;}    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -