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