# easy-elements/1.3.0/includes/Header_Footer_Builder/compatibility/class-wpml-compatibility.php

Easy Elements for Elementor – Addons &amp; Website Templates, version 1.3.0. 89 lines.

- Page: https://pluginprobe.com/plugins/easy-elements/1.3.0/code/includes/Header_Footer_Builder/compatibility/class-wpml-compatibility.php
- Raw: https://pluginprobe.com/plugins/easy-elements/1.3.0/raw/includes/Header_Footer_Builder/compatibility/class-wpml-compatibility.php
- Modified: 2026-01-11T12:20:02+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/easy-elements/1.3.0/code/includes/Header_Footer_Builder/compatibility/class-wpml-compatibility.php#L10-L20`.

```php
<?php
/**
 * WPML Compatibility for Header Footer Elementor.
 *
 * @package     EASYEL
 * @author      EASYEL
 * @copyright   Copyright (c) 2018, EASYEL
 * @since       EASYEL 1.0.0
 */

defined( 'ABSPATH' ) || exit;

/**
 * Set up WPML Compatibiblity Class.
 */
class EASYEL_WPML_Compatibility {

	/**
	 * Instance of EASYEL_WPML_Compatibility.
	 *
	 * @since  1.0.9
	 * @var null
	 */
	private static $_instance = null;

	/**
	 * Get instance of EASYEL_WPML_Compatibility
	 *
	 * @since  1.0.9
	 * @return EASYEL_WPML_Compatibility
	 */
	public static function instance() {
		if ( ! isset( self::$_instance ) ) {
			self::$_instance = new self();
		}

		return self::$_instance;
	}

	/**
	 * Setup actions and filters.
	 *
	 * @since  1.0.9
	 */
	private function __construct() {
		add_filter( 'easyel_get_settings_type_header', [ $this, 'easyel_wpml_object' ] );
		add_filter( 'easyel_get_settings_type_easy_after__header', [ $this, 'easyel_wpml_object' ] );
		add_filter( 'easyel_get_settings_type_footer', [ $this, 'easyel_wpml_object' ] );
		add_filter( 'easyel_get_settings_type_before_footer', [ $this, 'easyel_wpml_object' ] );
		add_filter( 'easyel_get_settings_type_easy_topbar', [ $this, 'easyel_wpml_object' ] );
		add_filter( 'hfe_render_template_id', [ $this, 'easyel_wpml_object' ] );
	}

	/**
	 * Pass the final header and footer ID from the WPML's object filter to allow strings to be translated.
	 *
	 * @since  1.0.0
	 * @param  Int $id  Post ID of the template being rendered.
	 * @return Int $id  Post ID of the template being rendered, Passed through the `wpml_object_id` id.
	 */
	public function easyel_wpml_object( $id ) {
		$translated_id = apply_filters( 'wpml_object_id', $id );

		if ( defined( 'POLYLANG_BASENAME' ) ) {

			if ( null === $translated_id ) {

				// The current language is not defined yet or translation is not available.
				return $id;
			} else {

				// Return translated post ID.
				return $translated_id;
			}
		}

		if ( null === $translated_id ) {
			$translated_id = '';
		}

		return $translated_id;
	}
}

/**
 * Initiate the class.
 */
EASYEL_WPML_Compatibility::instance();

```
