最近老牛準備用 WordPress3.9 做一個網站,註冊的會員可以投稿,所以必須用到呼叫作者資訊的函式,把正確的呼叫方法貼出來方便以後再次使用。
獲取作者名稱函式示例如下:
<?php the_author();?>
可以呼叫的欄位如下:
the_author 顯示文章的作者
the_author_description 顯示文章作者的描述 (作者個人資料中的描述)
the_author_login 顯示文章作者的登入名
the_author_firstname 顯示文章作者的 firstname(名)
the_author_lastname 顯示文章作者的 lastname(姓)
the_author_nickname 顯示文章作者的暱稱
the_author_ID 顯示文章作者的 ID 號
the_author_email 顯示文章作者的電子郵箱
the_author_url 顯示文章作者的網站地址
list_authors (不推薦使用) 顯示 blog 所有作者和他們的相關資訊。完整函式如下:
引數:
optioncount:是否顯示各作者已發表文章的篇數,可選值為:TRUE 和 FALSE(預設值)