Hello,
I am using the [course_search] shortcode on both EN and BG versions of my homepage. I also have all my courses translated.
When I use the search form, generated by the shortcode, on either language-version of the page, I always get results from my default language (BG). Is there a parameter I can add to the shortcode to indicate the language to search or should it obtain it automatically and this is a bug?
Well we are using wordpress simple function home_url function in course search shortcode which wpml should have overwrite .
Now we can try adding a new shortcode with wpml filter " wpml_home_url " applied Please add the given code in your wplms-customizer.php file in wplms customizer plugin :
add_shortcode('course_search_wpml', array($this,'vibe_course_search_wpml'));
function vibe_course_search_wpml( $atts, $content = null ) {
extract(shortcode_atts(array(
'style' => 'left'
), $atts));
$html ='<form role="search" method="get" class="'.$style.'" action="'.apply_filters( 'wpml_home_url', home_url( '/' ) ).'">
<input type="hidden" name="post_type" value="'.BP_COURSE_SLUG.'" />
<input type="text" value="'.(isset($_GET['s'])?$_GET['s']:'').'" name="s" id="s" placeholder="'.__('Type Keywords..','vibe-shortcodes').'" />
<input type="submit" id="searchsubmit" value="'.__('Search','vibe-shortcodes').'" />
</form>';
return $html;
}
And then user [course_search_wpml] shortcode instead of [course_search]