在使用WordPress制作个人博客时,如果想要显示作者的QQ或微信,可以使用以下这段代码:
function wdp_new_contactmethods( $contactmethods ) {
// Add QQ
$contactmethods['qq'] = 'qq';
//add WeiXin
$contactmethods['weixin'] = 'weixin';
return $contactmethods;
}
add_filter('user_contactmethods','wdp_new_contactmethods',10,1);
// Add QQ
$contactmethods['qq'] = 'qq';
//add WeiXin
$contactmethods['weixin'] = 'weixin';
return $contactmethods;
}
add_filter('user_contactmethods','wdp_new_contactmethods',10,1);
在需要的地方调用即可:
<?php echo $curauth->qq; ?>
<?php echo $curauth->weixin; ?>
<?php echo $curauth->weixin; ?>