Hồ sơ người dùng trong WordPress có các trường này cho Thông tin liên hệ theo mặc định: E-mail, Trang web, AIM, Yahoo IM, Jabber / Google Talk. Bạn có thể xóa những cái đó và thêm những cái mới tùy thích, như trong mã ví dụ này cho tệp functions.php trong chủ đề của bạn:
function new_contactmethods( $contactmethods ) ( $contactmethods('twitter') = 'Twitter'; // Add Twitter $contactmethods('facebook') = 'Facebook'; // Add Facebook unset($contactmethods('yim')); // Remove YIM unset($contactmethods('aim')); // Remove AIM unset($contactmethods('jabber')); // Remove Jabber return $contactmethods; )
Để hiển thị công khai, bạn có thể:
$user_id = 1; $key = 'twitter'; $single = true; $user_twitter = get_user_meta( $user_id, $key, $single); echo $user_twitter;