| 1 |
<?php |
| 2 |
/** |
| 3 |
* Themify Compatibility Code |
| 4 |
* |
| 5 |
* @package Themify |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* WPML |
| 10 |
* @link https://wpml.org/ |
| 11 |
*/ |
| 12 |
class Themify_Compat_wpml { |
| 13 |
|
| 14 |
static function init() { |
| 15 |
if ( class_exists( 'SitePress',false ) ) { |
| 16 |
add_action( 'themify_search_fields', [ __CLASS__, 'themify_search_fields' ] ); |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Add current language to the search form, fix Ajax search with WPML |
| 22 |
*/ |
| 23 |
public static function themify_search_fields() { |
| 24 |
global $sitepress; |
| 25 |
$current_language = $sitepress->get_current_language(); |
| 26 |
echo '<input type="hidden" name="lang" value="' . esc_attr( $current_language ) . '" />'; |
| 27 |
} |
| 28 |
} |