yit_wpml_object_id

Get id of post translation in current language.

Description

(int) yit_wpml_object_id( (int) $element_id, (string) $element_type = 'post', (constant) $return_original_if_missing = false, (null) $ulanguage_code = null ); 

Returns (int)

the translation id

Parameters (4)

0. $element_id (int)
The element id.
1. $element_type — Optional. (string) => 'post'
The element type.
2. $return_original_if_missing — Optional. (constant) => false
The return original if missing.
3. $ulanguage_code — Optional. (null) => null
The ulanguage code.

Usage

  1. if ( !function_exists( 'yit_wpml_object_id' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yith-woocommerce-wishlist/plugin-fw/yit-functions.php'; 
  3.  
  4. // The element id. 
  5. $element_id = -1; 
  6.  
  7. // The element type. 
  8. $element_type = 'post'; 
  9.  
  10. // The return original if missing. 
  11. $return_original_if_missing = false; 
  12.  
  13. // The ulanguage code. 
  14. $ulanguage_code = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = yit_wpml_object_id($element_id, $element_type, $return_original_if_missing, $ulanguage_code); 
  18.  

Defined (1)

The function is defined in the following location(s).

/plugin-fw/yit-functions.php  
  1. function yit_wpml_object_id ( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) { 
  2. if ( function_exists ( 'wpml_object_id_filter' ) ) { 
  3. return wpml_object_id_filter( $element_id, $element_type, $return_original_if_missing, $ulanguage_code ); 
  4. } elseif ( function_exists ( 'icl_object_id' ) ) { 
  5. return icl_object_id ( $element_id, $element_type, $return_original_if_missing, $ulanguage_code ); 
  6. } else { 
  7. return $element_id;