post_title; endif; endif; return $title; } public static function post_type_link( $url, $post, $leavename ) { if ( self::can_localize( $post ) ): // Get post ID $id = $post->ID; // Get translated post ID $translated_id = icl_object_id( $id, 'any', false, ICL_LANGUAGE_CODE ); if ( $translated_id && $translated_id != $id ): return get_permalink( $translated_id, $leavename ); endif; endif; return $url; } public static function can_localize( $post, $id = null ) { return function_exists( 'icl_object_id' ) && is_sp_post_type( get_post_type( $post ) ) && $id != get_the_ID(); } } endif; return new SP_WPML();