在你的博客上有多个作者将非常有趣,我们需要一个好的方法来弄作者有关网页:显示他们最新的文章,高亮显示他们的评论,以及在每篇文章下方显示他们的头像和简介.
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(); ?>
解决方法:
- How To: Adding An Author Page To Your WordPress Blog
- Using Author Template Tags Outside of the WordPress Loop
- Kafkaesquí’s Get Author Profile Plugin- 读取作者信息并能够展示出来,比如在侧边栏的博客拥有者介绍或博客的贡献者列表.
2. 在每篇文章下显示作者简介
如果你想像上面这样在文章页面显示作者简介和头像, 方法如下:
- Doing more with gravatars: Part 2- 如何在你的单个文章页放置一个基本的“About the Author”区域并且为每一个作者显示一个头像.
- How To Add Bio Info To Your WordPress Blog Posts
- Display Author Profile with Author Exposed
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() ?>">
这篇文章翻译的是”最常用到的11个 WordPress 技巧”中的一个
原文地址http://www.noupe.com/wordpress/most-desired-wordpress-hacks-11-common-requests-and-fixes.html

相关日志
One Ping to “wordpress文章作者相关技巧”
20 Responses to “wordpress文章作者相关技巧”
-
1. 悠悠吖吖 Says:
八月 27th, 2008 at 19:52嗯 看起来不错 值得一试
-
2. 别用鼠标点我 Says:
八月 27th, 2008 at 22:46我正有此意~感觉我现在的 关于 页面不太专业·~
-
3. IZK Says:
八月 28th, 2008 at 00:44这个很好啊。就是我看不懂- -
-
4. Yacca Says:
八月 28th, 2008 at 13:18我现在用id来鉴别用户,如果是id为1 就显示不同的css …
呵呵 不好的地方在于 必须登陆 -
5. 风吟 Says:
八月 28th, 2008 at 20:57怒风哥哥你好帅。。
-
6. sfox Says:
八月 28th, 2008 at 22:15这个暂时未需要用到,不过以后可能有用,先收藏了,呵呵~~
-
7. blazeq Says:
八月 31st, 2008 at 20:06学习了啊,不是来打酱油的。
-
8. 投资理财网 Says:
十二月 18th, 2008 at 18:41顶~~~~我叫投资理财网,希望能交个朋友哈!
-
9. Kaamajak Says:
八月 31st, 2009 at 07:59How long have you been blogging…your good at it.
-
10. aiv1 Says:
九月 25th, 2009 at 23:19您好,我想单击作者名字后打开页面显示所有此作者发布的文章。。不知该如何链接呢?盼回复!

九月 1st, 2008 at 10:45
[...] from:wordpress文章作者相关技巧 by:怒风的博客 [...]