i-Piggy.com

我愛科技
4ever-host 網頁寄存

讓 Wordpress 2.5 風格支援 Gravatar

March 26, 2008

Gravatar介紹過 WordPress 2.5 重點功能後,再來就是修改一下風格 (Theme) 設計,加入 Gravatars 頭像,以配合 WordPress 2.5 的新功能。

為 WordPress 2.5 加上 Gravatar

以往的 WordPress 需要安裝外掛插件才能使用 Gravatar,但在 WordPress 2.5 開始內建 Gravatar,所以新的風格設計亦宜加入 Gravatar。

要加入 Gravatar 到 comments.php 中,可在你想要頭像顯示的位置貼上以下代碼:

<?php echo get_avatar( get_comment_author_email(), '64', '<如果沒有頭像所顯示的IMG URL>' ) ?>

用戶使用方法

安裝過 Gravatar 後,訪客只須在 Gravatar 網站註冊,並根據指示上載頭像,設定基本資料。留言的時候,只須輸入在 Gravatar 註冊的電子郵件,即可在留言旁自動顯示頭像。訪客亦能在 WordPress 控制台的設定中,取消顯示頭像。

2 responses

  1. Kevin Yung 說:

    測試留言…你可以看到右邊已能顯示 Gravatar 了。請先申請 Gravatar 帳號,上載頭像,然後使用該註冊的電子郵件留言即可顯示頭像。


  2. pengshao 說:

    测试


Leave a Reply

XHTML: 你可使用這些標籤: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>