
內容簡介
WordPress 的 WP Custom Author Image 外掛讓您輕鬆地在您的網站上新增自訂作者圖像。
它提供了一個小工具,可以將其插入側邊欄或任何主題允許的小工具區域。
外掛現在支援一個短代碼 [wp-custom-author-image],您可以使用它直接將圖像添加到頁面或文章內容中。
或者,您可以在迴圈中放置以下呼叫,以顯示 WP Custom Author Image:
<?php the_wp_custom_author_image($author_id = null); ?>
此 $author_id 參數是可選的。如果沒有傳入,程式碼將會嘗試取得當前頁面 / 文章的作者。
此函數的第二個版本可傳入寬度和高度以顯示圖像。
<?php the_wp_custom_author_image_size($width, $height, $author_id = null); ?>
此 $author_id 參數是可選的。如果沒有傳入,程式碼將會嘗試取得當前頁面 / 文章的作者。
要設定 WP Custom Author Image,請在管理區域中瀏覽「使用者 / 您的個人資料」。
設定 WP Custom Author Image 大小
您可以透過 WP Custom Author Image 小工具或使用 the_wp_custom_author_image_size 函數呼叫來調整實際顯示大小。
如果沒有指定大小,將使用實際圖像的寬度和高度。
短代碼
您可以使用 [wp-custom-author-image] 來在您的頁面 / 文章內容中顯示已上傳的 WP Custom Author Image。
多作者網站
對於有眾多作者的網站,此小工具可以在作者的文章庫中插入一個連結 — 他的檔案庫。
單一作者網站
通常情況下,當小工具能清楚地確定內容的作者是誰時,它才會顯示 WP Custom Author Image。換句話說,在單數頁面或迴圈中。
如果您在單一作者網站或具有多個匿名作者的網站上運行,請務必勾選「此網站僅有單一作者」選項。小工具將隨時輸出您的圖像。
替代「關於我」頁面連結
通常情況下,如果單擊圖像,小工具會使用作者的文章頁面(/author/作者名稱/)。如果您的網站有專門的「關於我」頁面,
這頁面在「您的個人資料」中有一個新欄位叫做「關於我」頁面。在此欄位中輸入 URL(/about-me/)將導致小工具使用此連結而非 /author/作者名稱。
擷取作者 URL
您可以透過呼叫以下函數來擷取相應的 WP Custom Author Image 的 URL
<?php the_wp_custom_author_image_url($author_id = null); ?>
如果 $author_id 是空白的,外掛將會嘗試取得當前的作者和取得他/她的圖像。
外掛標籤
開發者團隊
原文外掛簡介
The WP Custom Author Image plugin for WordPress lets you easily add WP Custom Author Images on your site.
It creates a widget that you can insert in a sidebar or any other widget area allowed by your theme.
The plugin now supports a short code [wp-custom-author-image] you can use to directly add the image to the page or post content.
Alternatively, you can place the following call in the loop where you want the WP Custom Author Image to appear:
This $author_id parameter is optional. If it is not passed in, the code will attempt to get the current author of the page/post.
A second version of this function exists whereby you can pass in width and height to display the image.
This $author_id parameter is optional. If it is not passed in, the code will attempt to get the current author of the page/post.
To configure your WP Custom Author Image, browse Users / Your Profile in the admin area.
Setting WP Custom Author Image Size
You can adjust the actual display size in the WP Custom Author Image widget or by using the_wp_custom_author_image_size function call.
If you do not specify a size the width and height of the actual image will be used.
Shortcode
You can use [wp-custom-author-image] to display the uploaded WP Custom Author Image in your page/post content.
Multi-Author Sites
For sites with multitudes of authors, the widget offers the ability to insert a link to the author’s posts — his archives.
Single Author Sites
Normally the widget will only display an WP Custom Author Image when it can clearly identify who the content’s author actually is. In other words, on singular pages or in the loop.
If you run a single author site, or a site with multiple ghost writers, be sure to check the “This site has a single author” option. The widget will then output your image at all times.
Alternate About Page Link
Normally the widget will use the author’s posts page (/author/authorname/) is the image is clicked on. If your site has a dedicated page for the author, such as an ‘About Me’ page,
there is a new field in ‘Your Profile’ called ‘About Me Page’. Entering a url in this field (/about-me/) will cause the widget to use this link as opposed to /author/authorname.
Retrieving Author Url
You can retrieve the url to the respective WP Custom Author Image by calling the function
If $author_id is blank the plugin will attempt to determine the current author and retrieve his/her image.
