Feed Post Thumbnail

外掛說明

使用這個外掛邊能為網站的 RSS 資訊提供加入 MRSS 命名空間,這樣便能為 RSS 資訊摘要加入內容縮圖。

Feed Post Thumbnail 是一款輕量化的外掛,它只在 [設定]→[閱讀] 中增加了兩項設定。

專案參與方式

如果想參與這個外掛專案、回報問題或其他項目,請前往這個外掛的 GitHub 存放庫進行。

這個外掛的開發者為 required

螢幕擷圖

  • 這個外掛在 [閱讀] 設定頁面顯示的功能選項

安裝方式

手動安裝

  1. 將外掛安裝套件 ZIP 壓縮檔解壓縮後所得的 wp-feed-post-thumbnail 資料夾,上傳至網站的 /wp-content/plugins/ 目錄中。
  2. 在 WordPress 管理後台的 [外掛] 選單中啟用 Feed Post Thumbnail。
  3. 這時網站的 RSS 資訊提供便多出過去沒有的媒體資訊。

常見問題集

啟用這個外掛後,網站 RSS 資訊提供的格式是否仍正確無誤?

是的。這個外掛只在 RSS 資訊提供中加入正確、合適的 XML 命名空間,所以內容格式仍會如預期般正確無誤。

這個外掛是否提供可以強制指定縮圖尺寸的方式?

可以。為了達成這個目的,這個外掛提供兩個篩選器:

// Filters the size on media:content tag. Defaults to 'full'.
add_filter( 'wp_feed_post_thumbnail_image_size_full', function( $size ) {
    return 'large'; // Return any registered image size.
}, 10, 1 );

// Filters the size on the media:thumbnail tag. Defaults to 'thumbnail'.
add_filter( 'wp_feed_post_thumbnail_image_size_thumbnail', function( $size ) {
    return 'medium'; // Return any registered image size.
}, 10, 1 );

是否能變更用於顯示的圖片?

可以。為了達成這個目的,這個外掛提供兩個篩選器:

// Filters the featured image attachment post object.
add_filter( 'wp_feed_post_thumbnail_image', function( $thumbnail ) {
    return ''; // Return an empty string or another attachment post object.
}, 10, 1 );

// Filters the array of attachment post objects. Defaults to featured image post object if exists.
add_filter( 'wp_feed_post_thumbnail_images', function( $images ) {
    $attachment_id = '123';
    $images[] =  get_post( $attachment_id ); // Additional attachment post object.
    return images;
}, 10, 1 );

是否能變更與圖片一起顯示的標題、內容說明或作者資訊?

可以。以下篩選器可以達成上述目的:

// Filters the title on the media:title tag. Defaults to attachment title.
add_filter( 'wp_feed_post_thumbnail_title', function( $title ) {
    return 'Override title'; // Return any plain text.
}, 10, 1 );

// Filters the text on the media:description tag. Defaults to attachment description.
add_filter( 'wp_feed_post_thumbnail_description', function( $description ) {
    return 'Same description for all images'; // Return any plain string.
}, 10, 1 );

// Filters the name of the author on the media:copyright tag. Defaults to attachment author.
add_filter( 'wp_feed_post_thumbnail_author', function( $author_name ) {
    return 'Matt'; // Return any plain string.
}, 10, 1 );

使用者評論

2016 年 10 月 27 日 5 則留言
Tried refreshing permalinks, saving settings on the General settings page you've added the two checkboxes to, nothing makes a difference. No post thumbnail in the feeds... Update! And then it started working! I'm guessing this may have had something to do with either my hosting's caching or possibly even just my own browser cache. Works like a dream, thank you!
閱讀全部 1 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Feed Post Thumbnail〉的開發相關工作。

參與者

〈Feed Post Thumbnail〉外掛目前已有 4 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將〈Feed Post Thumbnail〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

3.0.0 -2023-03-27

  • Enhancement: Add setting to disable adding Media RSS namespace.
  • Fixed: Prevent errors when unchecking all settings.
  • Changed: Requires at least PHP 7.4 and WordPress 6.0.

2.1.2 – 2019-03-11

  • Enhancement: Minor code improvements.
  • Enhancement: New filter wp_feed_post_thumbnail_images to list multiple images
  • Changed: minimum PHP version 5.4 & minimum WP version 4.7

For previous updates see Changelog.md.