wordpress如何显示作者信息?

Auth:hrg520       Date:2014/01/25       Cat:网站建设       Word:共439字       Views:860

有时候,大主题未必有小功能,就像这个,在每篇文章的下面显示作者信息,包括作者的头像、名字以及个人描述。 直接上代码,只需把下面的代码扔到主题functions.php文件代码中就OK了 add_filter('the_content','webzty_author_meta'); function webzty_author_meta($content){ if(is_singular()){ $id=get_the_author_meta('ID'); $avatar='

'.get_avatar($id,64).'

'; $author='

作者: '.get_the_author_meta('display_name').'

'; $des='

'.get_the_author_meta('user_description').'

'; $content=$content.$avatar.$author.$des; } return $content; } 搞定后,将要在每篇文章下面出现作者的一些信息!

除非注明,瑞刚博客文章均为原创,本文地址 http://ruigang.win/archives/168.html,转载请以链接形式注明出处。

作者: 简介:一个小小医生

《wordpress如何显示作者信息?》留言数:0

发表留言