如何在WordPress文章末尾添加一个作者信息卡片?

如果WordPress站点开放注册并允许发布文章功能,就想要添加一个作者信息卡片,让用户对作者的信息一目了然,从而提高作者的贡献积极性,更好的吸引读者。那么如何在WordPress文章末尾添加一个作者信息卡片?

请看以下代码:

//作者信息卡片

function get_author_card() {

echo ‘<style type=”text/css”>a img {border-radius:5px;}</style>

<div style=”color:#777;border:1px solid #eaeaea;border-radius:4px;text-align:center;margin:0 0 20px;”><ul style=”margin:10px 0 10px;list-style-type: none;”><li><a href=”‘.get_author_posts_url(%20get_the_author_meta(%20’ID’%20)%20).'”>’.get_avatar( get_the_author_meta( ‘ID’ ), 60 ).'</a></li><li>’.get_the_author_meta( ‘display_name’ ).'</li><li style=”margin:0 10%”>’.get_the_author_meta( ‘description’ ).'</li></ul></div>’;

}

//在需要调用作者信息的地方插入下方代码

<?php echo get_author_card(); ?>

标签

发表评论