作者:noupe 来源:怒风的Blog   酷勤网收集 2008-08-27

摘要
  默认情况下,Wordpress将先使用author.php模板然后是archive.php最后是index.php来显示作者信息. 意思是,如果你没有author.php文件, WordPress将使用archive.php, 以此类推.

在你的博客上有多个作者将非常有趣,我们需要一个好的方法来弄作者有关网页:显示他们最新的文章,高亮显示他们的评论,以及在每篇文章下方显示他们的头像和简介.

1. 在你的wordpress博客上创建作者页面

默认情况下,Wordpress将先使用author.php模板然后是archive.php最后是index.php来显示作者信息. 意思是,如果你没有author.php文件, WordPress将使用archive.php, 以此类推.

所以, 如果你想更换作者页面的外观, 你需要创建一个author.php文件(如果主题没有),方法:复制archive.php或index.php.

如果你想要显示作者的主要网站,email联系地址,简介来帮助读者更好地认识这个作者,在适当位置加入下面的代码:

Articles by <?php the_author(); ?>
Author Website: <?php the_author_url(); ?>
Author Email: <?php the_author_email(); ?>
Author Bio: <?php the_author_description(); ?>

解决方法:

2. 在每篇文章下显示作者简介

如果你想像上面这样在文章页面显示作者简介和头像, 方法如下:

3. 分开作者的评论和其他人的评论

当你的博客有多个作者时,你将需要把作者的评论区单独列出来,可以使用下面的代码:

<li class=”<?php if ($comment->comment_author_email == “authorname@domain.com”) echo ‘author’; else if ($comment->comment_author_email == “anotherauthorname@domain.com”) echo ‘author2′; else if ($comment->comment_author_email == “thirdauthorname@domain.com”) echo ‘author3′; else echo $oddcomment; ?> item” id=”comment-<?php comment_ID() ?>”>

原文地址http://www.noupe.com/wordpress/most-desired-wordpress-hacks-11-common-requests-and-fixes.html
来自:http://nufeng.cn/wordpress-post-author-related-solutions/

分类: 站长经验 Web开发 网页设计

上一篇:在WordPress博客上显示twitter消息   下一篇:灵戈:官方抢注奥运冠军域名意在何为