I created a multi-language presentation site using polylang plugin. I am very happy with this plugin, except the way it handles the search form. When i try to search anything, the menu disappears and it doesn't search in the desired language .
Asked
Active
Viewed 3,953 times
1 Answers
1
i managed to resolve my problem by following the next steps:
I created a file searchform.php and entered the following code:
// the . 'index.php/' part is not mandatory, my website works like this. you can try without it
<form method="get" class="search-form form-inline" id="searchform"
action="<?php echo esc_url(home_url('/') . 'index.php/' . pll_current_language() . '/'); ?>">
<div class="input-group">
<input type="text" class="search-field form-control" name="s" id="s" placeholder="<?php pll_e('Search'); ?>"/>
<span class="input-group-btn">
<button type="submit" class="search-submit btn btn-default"><?php pll_e('Search'); ?></button>
</span>
</div>
</form>
if the code <?php get_search_form(); ?>
doesn't display your custom form, you can always use:
<?php get_template_part('searchform'); ?>

Laura Chesches
- 2,493
- 1
- 19
- 15