Ejemplo n.º 1
0
 /**
  * Get menu items for a given
  * menu location
  *
  * @param string $theme_location
  *
  * @return array|bool|false
  */
 public static function get_menu_items($theme_location = 'primary')
 {
     $locations = get_nav_menu_locations();
     if (!isset($locations[$theme_location])) {
         return false;
     }
     $menu_id = $locations[$theme_location];
     if (function_exists('wpml_object_id')) {
         $menu_id = wpml_object_id((int) $menu_id, 'nav_menu');
     }
     return wp_get_nav_menu_items($menu_id);
 }
Ejemplo n.º 2
0
/**
 * Returns the object identifier for the current language (WPML).
 *
 * @since	2.1.0
 *
 * @param	$post_id	Post ID
 */
function tptn_object_id_cur_lang($post_id)
{
    if (function_exists('wpml_object_id')) {
        $post_id = wpml_object_id($post_id, 'post', TRUE);
    } elseif (function_exists('icl_object_id')) {
        $post_id = icl_object_id($post_id, 'post', TRUE);
    }
    /**
     * Filters object ID for current language (WPML).
     *
     * @since	2.1.0
     *
     * @param	int	$post_id	Post ID
     */
    return apply_filters('tptn_object_id_cur_lang', $post_id);
}
 /**
  * Get id of post translation in current language
  *
  * @param int         $element_id
  * @param string      $element_type
  * @param bool        $return_original_if_missing
  * @param null|string $ulanguage_code
  *
  * @return int the translation id
  * @since  2.0.0
  * @author Antonio La Rocca <*****@*****.**>
  */
 function yit_wpml_object_id($element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null)
 {
     if (function_exists('wpml_object_id')) {
         return wpml_object_id($element_id, $element_type, $return_original_if_missing, $ulanguage_code);
     } elseif (function_exists('icl_object_id')) {
         return icl_object_id($element_id, $element_type, $return_original_if_missing, $ulanguage_code);
     } else {
         return $element_id;
     }
 }