A
A
Andy-shak2015-11-24 14:44:38
WordPress
Andy-shak, 2015-11-24 14:44:38

How to implement 2 search forms on the same page in WordPress?

How to implement 2 searches on a website in WordPress? One search in header.php, the second in footer.php.
I do a search with a filter, I use labels as a filter.

<form role="search" method="get" id="<?php bloginfo('url'); ?>" action="<?php echo home_url( '/' ) ?>" >
<div class="form_search">
<input type="text"  placeholder="Введите запрос..." value="<?php echo get_search_query() ?>" name="s" id="s">
<select name="tag" form="<?php bloginfo('url'); ?>">
  <option value="product">Товары</option>
  <option value="service">Услуги</option>
</select> 
<button type="submit" id="searchsubmit">Поиск</button>
</div>
</form>

Similarly, I do the same in footer.php. When I start searching for one of the searches, they both work and a trace is displayed in the address bar. options "
site.org/?tag=product&s=&tag=product
duplicates the 2nd search.
How to implement so that the search works only one?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question