-1

I have this code:

<form role="search" method="get" id="searchform"
class="revtp-searchform" action="https://yourwebsitehere.com">
  <input type="text" value="" name="s" id="s" placeholder="Make your search here" />
  <input type="submit" id="searchsubmit" value="Find" />
</form>

The problem is that I want to have a search bar for my English version and another for my Spanish version. With the above code, it only looks for posts in my default English version. I use Polylang.

Can anybody help? Thanks.

icalvete
  • 987
  • 2
  • 16
  • 50

1 Answers1

0

By default wordpress provide one function to show search form

get_search_form();

It uses searchform.php if it is available in theme else it uses default search form of wordpress. You can create a file with name searchform.php in your child theme & put below code

<form role="search" method="get" id="searchform"
class="revtp-searchform" action="<?php echo esc_url(home_url('/') . 'index.php/' . pll_current_language() . '/'); ?>">
  <input type="text" value="" name="s" id="s" placeholder="Make your search here" />
  <input type="submit" id="searchsubmit" value="Find" />
</form>

//pll_current_language() will get current language of polylang