Issue with Moesia/Polylang: search function does not work in translated version


#1

Hello,

I am contacting your because the search function works fine in the French (original) version of our website https://syllabes.eu/ but does not work with the English version (translation).

Since we will soon also add a German version, would you know if there is anything that should be activated in the Moesia theme without having to edit the html/php code?

I found this article (which I did not understand 100%) and I am not confident editing the ‘searchform.php’ file.

Thanks in advance for your help!
Kind regards,
Laetitia


#2

Hello Laetitia,

The article suggests to use get_search_form() tag to avoid unmatched result when Polylang enabled. Moesia implements it already. You can check it in the functions.php file.

The get_search_form() can be found inside this function.

    /**
     * Nav bar
     */
    if ( ! function_exists( 'moesia_nav_bar' ) ) {
    function moesia_nav_bar() {
    	echo '<div class="top-bar">
    			<div class="container">
    				<div class="site-branding col-md-4">';
    				if ( get_theme_mod('site_logo') ) :
    					echo '<a href="' . esc_url( home_url( '/' ) ) . '" title="';
    						bloginfo('name');
    					echo '"><img class="site-logo" src="' . esc_url(get_theme_mod('site_logo')) . '" alt="';
    						bloginfo('name');
    					echo '" /></a>';
    				else :
    					echo '<h1 class="site-title"><a href="' . esc_url( home_url( '/' ) ) . '" rel="home">';
    						bloginfo( 'name' );
    					echo '</a></h1>';
    					echo '<h2 class="site-description">';
    						bloginfo( 'description' );
    					echo '</h2>';
    				endif;
    			echo '</div>';
    			echo '<button class="menu-toggle btn"><i class="fa fa-bars"></i></button>
    				<nav id="site-navigation" class="main-navigation col-md-8" role="navigation">';
    				wp_nav_menu( array( 'theme_location' => 'primary' ) );
    			echo '</nav>';

    			if ( get_theme_mod('toggle_search', 0) ) :
    				echo '<span class="nav-search"><i class="fa fa-search"></i></span>';
    				echo '<span class="nav-deco"></span>';
    				echo '<div class="nav-search-box">';
    					get_search_form();
    				echo '</div>';
    			endif;
    		echo '</div>';
    	echo '</div>';
    }
    }

Do your language menus links to its proper translation address?

58

Please check this article.

You might need to correct your language switcher links?

Regards,
Kharis