# themify-builder/trunk/themify/plugin-compat/wpml.php

Themify Builder, version trunk. 28 lines.

- Page: https://pluginprobe.com/plugins/themify-builder/trunk/code/themify/plugin-compat/wpml.php
- Raw: https://pluginprobe.com/plugins/themify-builder/trunk/raw/themify/plugin-compat/wpml.php
- Modified: 2024-05-27T20:18:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/themify-builder/trunk/code/themify/plugin-compat/wpml.php#L10-L20`.

```php
<?php
/**
 * Themify Compatibility Code
 *
 * @package Themify
 */

/**
 * WPML
 * @link https://wpml.org/
 */
class Themify_Compat_wpml {

    static function init() {
        if ( class_exists( 'SitePress',false ) ) {
            add_action( 'themify_search_fields', [ __CLASS__, 'themify_search_fields' ] );
        }
    }

    /**
     * Add current language to the search form, fix Ajax search with WPML
     */
    public static function themify_search_fields() {
        global $sitepress;
        $current_language = $sitepress->get_current_language();
        echo '<input type="hidden" name="lang" value="' . esc_attr( $current_language ) . '" />';
    }
}
```
