【www.bbyears.com--WordPress】
用户个人资料的联系信息里,默认有邮箱、站点、AIM、雅虎通和 Jabber,而有些东西我们可能都没听说过,所以去除是非常有必要的。本文就来教你,怎么自定义这些信息的项目。
下边的代码删除了 AIM、雅虎通和 Jabber,添加了新浪微博、腾讯微博和 QQ 这些国内比较常用的社交网络。
代码如下function Bing_change_user_contact_information( $fields ){
unset( $fields["aim"] );
unset( $fields["yim"] );
unset( $fields["jabber"] );
$fields["weibo"] = "新浪微博";
$fields["t_weibo"] = "腾讯微博";
$fields["qq"] = "腾讯 QQ";
return $fields;
}
add_filter( "user_contactmethods", "Bing_change_user_contact_information" );
想获取这些信息只要使用 get_the_author_meta() 函数即可。
$weibo = get_the_author_meta( "weibo", $user_id );//新浪微博
$t_weibo = get_the_author_meta( "t_weibo", $user_id );//腾讯微博
$qq = get_the_author_meta( "qq", $user_id );//腾讯 QQ