我尝试向用户配置文件中添加信息字段。但我的代码没有运行!:-(
在里面functions.php
我添加:
function add_contact_profile($user_contact) {
$user_contact[\'twitter\'] = __(\'URL Twitter\');
$user_contact[\'facebook\'] = __(\'URL Facebook\');
$user_contact[\'googleplus\'] = __(\'\');
$user_contact[\'linkedin\'] = __(\'URL Linkedin\');
return $user_contact;
}
add_filter(\'user_contactmethods\', \'add_contact_profile\', 99);
并且在header.php
我添加:<?php
if(get_the_author_meta(\'rss_url\') ){
echo(\'<a href="\'. get_author_feed_link( get_the_author_meta(\'ID\') ) .\'" target="_blank" class="social rss_url socialtooltip rss" data-original-title="RSS">
<i class="fa fa-rss"></i>
</a>\');
}
echo(\'<a href="\'. get_the_author_meta(\'googleplus\') .\'" target="_blank" class="social googleplus socialtooltip social-google-plus" data-original-title="Google+">
<i class="fa fa-google-plus"></i>
</a>\');
if(get_the_author_meta(\'facebook\') ){
echo(\'<a href="\'. get_the_author_meta(\'facebook\') .\'" target="_blank" class="social facebook socialtooltip social-facebook" data-original-title="Facebook">
<i class="fa fa-facebook"></i>
</a>\');
}
if(get_the_author_meta(\'twitter\') ){
echo(\'<a href="\'. get_the_author_meta(\'twitter\') .\'" target="_blank" class="social twitter socialtooltip social-twitter" data-original-title="Twitter">
<i class="fa fa-twitter"></i>
</a>\');
}
if(get_the_author_meta(\'linkedin\') ){
echo(\'<a href="\'. get_the_author_meta(\'linkedin\') .\'" target="_blank" class="social facebook socialtooltip social-linkedin" data-original-title="LinkedIn">
<i class="fa fa-linkedin"></i>
</a>\');
}
?>
P.S.
具有var_dump(get_the_author_meta(\'googleplus\'));
string(0);