[WordPress] 外掛分享: Smart Featured Image

首頁外掛目錄 › Smart Featured Image
10+
安裝啟用
尚無評分
3124 天前
最後更新
問題解決
WordPress 4.0+ PHP 5.3+ v0.2.4 上架:2017-06-07

內容簡介

重要提示: 此外掛需要 PHP 版本 5.3 或以上,建議使用 PHP 版本 7.0 或以上。

Smart Featured Image 是一個 WordPress 的外掛,可以自動將文章內容中的圖片設為特色圖片,當文章未設置特色圖片時。

預設情況下,WordPress 需要您為每個文章明確地設置特色圖片,即使該文章已經使用了圖片。

這個 Smart Featured Image 外掛可以省去設置特色圖片的步驟,只需儲存保存到文章內容的第一個本地圖片即可設置為該文章的特色圖片。

如果文章內容中找不到圖片,外掛會顯示預設圖片,而預設圖片設定可以在 WordPress 管理區域的媒體設定螢幕 (‘設定‘ -> ‘媒體‘) 中幫您完成。在這裡您可以設置每個公共文章類型的預設特色圖片。

Smart Featured Image 的運作方式如下:

檢查文章是否已添加特色圖片。
如果沒有,外掛會搜索與文章相關聯的圖片 (即當前文章上傳的圖片)。找到後,將固定使用第一個相關聯的圖片作為文章的特色圖片。
如果文章未上傳任何圖片,外掛將在文章內容中尋找插入的圖片,而不一定是與文章相關聯的圖片。找到後,將固定使用第一個插入的本地圖片作為特色圖片。
如果以上所有方法都失敗,外掛會回到媒體設定螢幕下的「預設特色圖片」中針對該文章類型所設定的預設圖片。

如在步驟 4 中所述,外掛不會將預設特色圖片保存為特色圖片,它只會在需要取得文章縮略圖時返回該預設特色圖片。這是預期的行為。

這意味著,每當預設特色圖片更改時,使用前一個預設特色圖片的所有文章都會自動使用新的預設特色圖片,因為舊圖片從未被儲存到資料庫中作為特色圖片。

您可以通過為任何特定的文章設置 no_sfi 自訂欄位並設置為除了 0 以外的任何值來禁用 Smart Featured Image。刪除自訂欄位,或將其設置為 0,可以恢復該文章的外掛功能。

請嘗試 Smart Featured Image 外掛,相信您會喜歡它的使用方式。

外掛標籤

開發者團隊

⬇ 下載最新版 (v0.2.4) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Smart Featured Image」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

IMPORTANT: This plugin requires PHP version 5.3 or newer. We recommend PHP version 7.0 or newer.
Smart Featured Image is a WordPress plugin to automagically add featured images to posts using images inserted into post content, if no featured image is added to a post.
WordPress, by default, requires you to explicitly set a featured image for each post even if there are images already used in the post.
The Smart Featured Image plugin frees you from the extra step of setting a featured image by saving the first local image it finds in the post content as featured image.
The plugin displays a configurable default image if no image is found in post content.
The default image settings are available via the Media Settings screen (‘Settings‘ -> ‘Media‘) in the WordPress administration area. There are options to set the default featured image for each public post type.
Smart Featured Image works by:

Checking if a featured image was added to the post.
If no featured image was added, the plugin looks for images attached to the post (ie images uploaded to the current post). If found, the first attached image is saved as the post’s featured image.
If no image was attached to the post, the plugin looks for an image inserted into the post content, but not necessary attached to the post. If found, the first local image inserted is saved as featured image.
If all of the above fail, the plugin falls back to the default featured image set for the post type in question under the Default Featured Image section of the Media Settings screen.

You would notice that, in step 4 above, the plugin does not save the default featured image as the featured image. Rather, it simply returns that image whenever a call to get the post thumbnail is made. This is the intended behaviour.
This means, any time the default featured image changes, all posts that used the previous default featured image would automatically use the new default featured image since the old one was never saved to the database as featured image.
You can disable smart featured image for any specific post by setting a no_sfi custom field to any value other than 0. Delete the custom field, or set to 0, to restore plugin functionality for that post.
Give Smart Featured Image a shot. You will love it.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon