将新自定义字段添加到作者配置文件
function my_epl_custom_user_contact( $contactmethods ) {
$contactmethods[\'custom\'] = __( \'Custom\', \'easy-property-listings\' );
return $contactmethods;
}
add_filter (\'user_contactmethods\',\'my_epl_custom_user_contact\',10,1);
创建自定义字段的HTML输出
function my_epl_get_custom_author_html($html = \'\') {
global $epl_author;
if ( $epl_author->custom != \'\' ) {
$html = \'
<a class="epl-author-icon author-icon custom-icon-24" href="http://custom.com/\' . $epl_author->custom . \'"
title="\'.__(\'Follow\', \'easy-property-listings\' ).\' \' . $epl_author->name . \' \'.__(\'on Custom\', \'easy-property-listings\' ).\'">\'.
__(\'C\', \'easy-property-listings\' ).
\'</a>\';
}
return $html;
}
添加自定义字段筛选器
function my_epl_custom_social_icons_filter( $html ) {
$html .= my_epl_get_custom_author_html();
return $html;
}
add_filter( \'epl_author_email_html\' , \'my_epl_custom_social_icons_filter\' );