WordPress 2.6让你的留言头像丰富多彩

Posted in WordPress / 软硬一本 @ Jul 17th, 2008 by underone |

WordPress 2.6中文版更新以后,我才正正经经的看了看新的后台变化,尤其是对theme制作来说,必须要知道哪里的变化是必须改进的。

丰富的头像选择。除了默认的头像之外,2.6在gravater上又增加了三个新选择,统统是可以根据用户的信箱地址生成唯一的头像——以避免没有注册gravater服务的留言用户头像千篇一律。没记错的话这三个新头像模式好像原来都是插件,应该是集成进去了。

博主只需要前往后台-设置-评论进行设置即可。

当然,对于某些主题(比如我的)来说,这样的设置还不够。因为有些主题设置了单独的默认头像。如果你使用的也是这样的主题(更改后台头像设置后前台没有看到五彩缤纷的用户头像),那么也很简单,比如我的主题关于头像部分的代码是(comments.php中):

  1. <?php echo get_avatar( $comment, 32, 'http://www.underone.com/wp-content/uploads/2008/04/avatar.png' ); ?>

只需修改为

  1. <?php echo get_avatar( $comment, 32 ); ?>

然后再到前台找个留言多的post看看,是不是头像都变得花里胡哨了?

延展阅读

32 Responses to “WordPress 2.6让你的留言头像丰富多彩”

  1. 胡戈戈  Reply to this comment

    <img src="comment_author_email) . '?s=32&r=any&default=' . urlencode(get_bloginfo('template_url') . "/images/gravatar.png"); ?>" class="gravatar" alt="" />

    不知道我这个要怎么改,我不想将原来的样式去掉

  2. underone  Reply to this comment

    把这部分直接删除试试?
    // &default=' . urlencode(get_bloginfo('template_url') . "/images/gravatar.png //

  3. 风吟  Reply to this comment

    默默哥哥你email是什么呀。。我信箱就是给你评论的这个。。
    麻烦帮我把LOGO的两个字改成风吟拉。谢谢!

  4. underone  Reply to this comment

    发你了

  5. Mao  Reply to this comment

    2.5开始我就是用调用=.=

  6. mg12  Reply to this comment

    其实那个 Don't show avatars 是禁用整个 Blog 的头像, 甚至连后台的头像都不会显示.
    WordPress 中获取头像的方法 get_avatar 会在最先通过对 get_option('show_avatars') 的检验确定是否能够显示头像, 如果不能则立刻返回 false. 这个方法在 2.5 中已是这么定义了. 看来 WordPress 2.5 只是 2.6 的序幕.

  7. 打篮球的手  Reply to this comment

    2.6为数不多的亮点~

  8. 锐风  Reply to this comment

    好乱哦..
    WP越来越垃圾了..

    强烈支持 Typecho 和 70 同志..

  9. Flyx  Reply to this comment

    wp的初衷还是好的,不过结果就不一定了,任何一个系统都不可能面面俱到,有时候反而是简单点好...

  10. underone  Reply to this comment

    没错。。

  11. under  Reply to this comment

    wp的初衷还是好的,不过结果就不一定了,任何一个系统都不可能面面俱到,有时候反而是简单点好...

  12. SK  Reply to this comment

    - -testing...

  13. cXY  Reply to this comment

    让我来试试自己的头像会是什么样子的呢?~~~

  14. cXY  Reply to this comment

    哈哈~~~果然是,gravatar.com里面的头像!只要是填的注册gravatar.com里面的email地址,到哪里都是一样的头像吧?

  15. underone  Reply to this comment

    是的

  16. xmwiki  Reply to this comment

    是的,看看先

  17. 虫儿飞  Reply to this comment

    我就不用,就不用,就不用…… T___T

  18. randem  Reply to this comment

    新版本出来了啊~! 我也要升咯~!

  19. 冰古  Reply to this comment

    啊哈,原来还有这个新功能。

  20. 长毛  Reply to this comment

    原来是这样啊

  21. underone  Reply to this comment

    你看,还有用你的纹身当头像的呢
    http://www.underone.com/2008/07/23/redcliff/

  22. 迪纳替你  Reply to this comment

    原来是这样啊

  23. 黑色饼干  Reply to this comment

    确实好看多了,不错

  24. Leeiio  Reply to this comment

    默認的三個自動生成都不好看,不知道有沒有更多的選擇。。

  25. Jason  Reply to this comment

    <img src="comment_author_email) . '?s=32&r=any&default=' . urlencode(get_bloginfo('template_url') . "/images/gravatar.png"); ?>" class="gravatar" alt="" />

    这一段代码真的不知道怎么弄啊。请帮个忙。

  26. wordpress头像设置 | 望月的博客  Reply to this comment

    [...] 想在自己的wordpress博客中显示评论这头像吗?如果是支持显示头像的模板,直接设置显示头像即可,如果不行可以这样修改。如果你是使用wordpress2.5,可以参考这篇文章进行设置,如果是使用更旧的版本,可以使用WP Gravatar 插件或者Gravatars2 插件。 [...]

  27. nwgale  Reply to this comment

    我试试会不会有新的头像。

  28. underone  Reply to this comment

    @nwgale: 没有。。。

  29. underone  Reply to this comment

    @Jason: 要弄啥?

  30. jokercc  Reply to this comment

    怎么把头像放到右边是我关心的问题!!!!

  31. iColor  Reply to this comment

    测试一下头像,,,-_-!!!

  32. daniel  Reply to this comment

    呀,我原来还没在意,现在搞上了

Leave a Reply ↓

收藏 & 分享

Powered by 17fav.com