[WordPress] 外掛分享: Category Image(s)

前言介紹

  • 這款 WordPress 外掛「Category Image(s)」是 2004-12-20 上架。
  • 目前有 100 個安裝啟用數。
  • 上一次更新是 2012-06-11,距離現在已有 4716 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 2.2 以上版本才可以安裝。
  • 有 2 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

coffee2code |

外掛標籤

icon | post | image | category | categories |

內容簡介

顯示每個文章關聯的分類的圖像。

注意事項:

此外掛提供了模板標籤,基本上複製和擴展了 WordPress 核心功能the_category ()的功能,以添加顯示分類圖像而不是連結到分類存檔頁面的分類名稱的能力。默認情況下,由於其 $image_extensions 參數設置為 "",因此此外掛可以取代the_category()的功能。就像在the_category()中所做的一樣,每個分類的圖像或文本也是一個指向該分類存檔頁面的鏈接。

有關此函數的相關信息:

如果定義了 $image_extensions,但該分類沒有找到圖像,則不會為該分類顯示任何內容。
$image_extensions可定義為空格分隔的圖像擴展名列表。會按照提供的擴展名的順序進行檢查,預設為 "png gif jpg"。
通過 $limit 參數可以限制顯示的分類鏈接/圖像的數量
分類圖像標籤是使用 class="catimage" 定義的,以便進行樣式表操作。
結果可以通過名為“c2c_the_category_image”的過濾器進行過濾。

必須在“循環”內運行。

c2c_get_category_image_list()是另一個提供的函數,它與完全相同,只是它不會回显結果。

鏈接:外掛首頁|插件目錄頁面|作者首頁

模板標籤

此外掛提供了一個可用於主題模板的可選模板標籤。

函數

這會顯示與文章分類相關聯的圖像。

參數

$separator
可選的參數。出現在文章分類圖像之間的文本和/或HTML。

$parents
可選的參數。允許您指定是否將文章分類的祖先分類也設置為圖像和鏈接。有效的選項是“multiple”,“single”和“”。默認值是“”。

$image_extensions
可選的參數。一個以空格分隔的圖像擴展名列表(不分大小寫)。如果定義為 "",則不會檢索圖像,而是顯示分類名稱(如the_category())。預設為“png gif jpg”。

$image_dir
可選的參數。分類圖像所在的目錄。該值應該是相對於您的博客的主URL的位置。默認為“/wp-content/images/”

$use_name_if_no_image
可選的參數。Boolean值(true或false),指示是否應該為每個沒有關聯圖像的分類顯示該分類的名稱。默認值為false。

$start_from
可選的參數。如何遍歷文章的分類列表;“begin”或“end”。

原文外掛簡介

Display an image for each category associated with a post.
Notes:
This plugin provides the templates tag c2c_the_category_image() which basically reproduces and extends the functionality of WordPress’s core function the_category() to add the ability to display a category image instead of the category name in the link to the category archive. With its $image_extensions argument defaulted to "", the plugin could be a drop-in replacement for the_category(). As is done in the_category(), the image or text for each category is also a link back to that category’s archive.
Related info about the function:

If $image_extensions is defined, but no image is found for the category, then nothing is displayed for that category.
$image_extensions can be defined as a space separated list of image extensions. Files will be checked with the image extensions in the order those extensions were provided; default is ‘png gif jpg’.
The number of category links/images displayed can be limited via the $limit argument
Category image tags are defined with class=”catimage” for stylesheet manipulation.
The result can be filtered via the filter named “c2c_the_category_image”.

Must be run inside “the loop”.
c2c_get_category_image_list() is another provided function, which is identical to c2c_the_category_image() except that it doesn’t echo the result.

Links: Plugin Homepage | Plugin Directory Page | Author Homepage
Template Tags
The plugin provides one optional template tag for use in your theme templates.
Functions

This displays the image associated with a post’s categories.
Arguments

$separator
Optional argument. The text and/or HTML to appear between each of a post’s category images.

$parents
Optional argument. Allows you to specify if you want ancestor categories of a post’s category to be imaged and linked as well. Valid options are ‘multiple’, ‘single’, and ”. Default is ”.

$image_extensions
Optional argument. A space-separated list of image extensions (case insensitive). If defined as ” then no image is retrieved and the category name is displayed instead (a la the_category()). Default is ‘png gif jpg’.

$image_dir
Optional argument. The directory in which the category image(s) reside. The value should be a location relative to the main URL of your blog. Default is ‘/wp-content/images/’

$use_name_if_no_image
Optional argument. Boolean value (true or false) indicating if the name of the category should be displayed for each category that does not have an associated image. Default is false.

$start_from
Optional argument. How to traverse the list of post’s categories; either ‘begin’ or ‘end’. Default is ‘begin’

$limit
Optional argument. The maximum number of category images to be displayed. Default is 999 (basically, no limit)

$post_id
Optional argument. The Post ID. If false, then use the current post (i.e. while in the loop). Default is false.

Examples

You can opt to treat only certain categories as having a graphical representation by defining an image for them but not creating images for the non-graphically represented categories (as in you can have a subset of categories that dictate what image to be displayed for the post).

You can take advantage of the $image_extension and/or $image_dir arguments to display different category icons under different contexts, i.e. if showing a $single post, choose to use a ‘png’ image, otherwise use ‘gif’; or locate your images in different directories ‘/wp-content/images/cat-images/small/’ and ‘/wp-content/images/cat-images/large/’ and decide based on context where to get the image(s) from:
// In showing the post singularly, then use a larger image, else use a small image
if ( is_single() ) {
c2c_the_category_image(”, ”, ‘gif’, ‘/wp-content/images/cat-images/large/’);
} else {
c2c_the_category_image(”, ”, ‘gif’, ‘/wp-content/images/cat-images/small/’);
}

Show all images in a comma-separated line:

Show all images in an unordered list:

Assuming one category per post, just show the category image without further HTML markup:

Filters
The plugin exposes two filters and one action for hooking. Typically, customizations utilizing these hooks would be put into your active theme’s functions.php file, or used by another plugin.

c2c_get_category_image (filter)
The ‘c2c_get_category_image’ hook allows you to use an alternative approach to safely invoke c2c_get_category_image() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.
Arguments:

same as for c2c_get_category_image()

Example:
Instead of:

Do:

c2c_get_the_category_image_list (filter)
The ‘c2c_get_the_category_image_list’ hook allows you to use an alternative approach to safely invoke c2c_get_the_category_image_list() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.
Arguments:

same as for c2c_get_the_category_image_list()

Example:
Instead of:

Do:

c2c_the_category_image (action)
The ‘c2c_the_category_image’ hook allows you to use an alternative approach to safely invoke c2c_the_category_image() in such a way that if the plugin were deactivated or deleted, then your calls to the function won’t cause errors in your site.
Arguments:

same as for c2c_the_category_image()

Example:
Instead of:

Do:

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Category Image(s)」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.7 | v1.0 | v1.1 | 1.7.1 | 1.7.2 | 1.7.3 | trunk |

延伸相關外掛(你可能也想知道)

  • Image Optimization by Optimole – Lazy Load, CDN, Convert WebP & AVIF, Optimize Images 》, Optimole的獨特之處在哪裡?, , 更小的圖片,同樣的品質, 完全自動化;設定一次就忘記它, 支援所有圖片格式, 支援Retina和WebP圖片, 以機器學習為基礎的自...。
  • Imsanity 》使用 Imsanity,自動調整大型圖片上傳大小。選擇你喜歡的尺寸和品質,讓 Imsanity 完成其餘所有工作。當投稿者上傳大於配置尺寸的圖片時,Imsanity 將自動將...。
  • Firelight Lightbox 》Easy FancyBox WordPress外掛為您的網站提供靈活美觀的光箱解決方案,幾乎適用於網站上的所有媒體連結。Easy FancyBox使用更新的傳統FancyBox jQuery擴展版本...。
  • Simple Lightbox 》Simple Lightbox 是一個非常簡單且可自定義的燈箱,在您的 WordPress 網站上添加它非常容易。, 功能, 自定義燈箱行為的選項位於外觀 > Lightbox 管理員菜...。
  • Robin image optimizer — save money on image compression 》需要專業支援嗎?, 開始免費支援, 開始高級支援, 透過減少圖像大小,讓您的網站加快速度。我們的 WordPress 圖像優化外掛,可以將圖像大小減少80%,而且不損...。
  • Responsive Lightbox & Gallery 》提供完整的 WordPress 相簿外掛所需一切, Responsive Lightbox and Gallery 外掛是一個全功能的 WordPress 相簿外掛,擁有強大的拖放相簿生成器和 Lightbox ...。
  • reSmush.it : The original free image compressor and optimizer plugin 》reSmush.it Image Optimizer 是一個 WordPress 外掛,透過 reSmush.it API 提供圖片優化服務。reSmush.it 使用多種高級演算法對圖像進行大小減小。API 支援最...。
  • Menu Image, Icons made easy 》這個外掛可以輕鬆地在選單項目中加入圖像或圖示,打造更好的網站選單。, 可以控制圖像或圖示的位置以及大小。, 這個 Menu Image 外掛還有其他功能,以下是其...。
  • Image Widget 》Image Widget 是一個簡單的外掛程式,利用 WordPress 原生媒體管理員,為您的網站新增圖片小工具。, 需要新增幻燈片、燈箱或隨機圖像嗎?, 請查看 Image Widg...。
  • Featured Image from URL (FIFU) 》h3>WordPress 外掛 - 用於顯示外部特色圖片、影片、音訊等等, FIFU 自 2015 年來已幫助全球數千個網站節省了儲存空間、處理時間和版權費用。, 如果您已經厭倦...。
  • Default Featured Image 》在媒體設定頁面上新增一個預設的特色圖像。如果沒有設定任何特色圖像,這個預設的特色圖像就會顯示。就這麼簡單。, 查看常見問題以獲取基本問題資訊。, 如果...。
  • All In One Favicon 》查看最新的WordPress交易以優化您的網站。, All In One Favicon為您的網站和管理頁面添加favicon。, 您可以使用您已經上傳的favicon或使用內置的上傳機制將fa...。
  • ImageMagick Engine 》透過讓 WordPress 使用 ImageMagick 而非標準的 GD 圖像庫,大幅提升重新調整大小的圖像品質。, 功能, , 在重新調整大小的圖像中保留嵌入式色彩設定檔, 自動...。
  • WP Featherlight – A Simple jQuery Lightbox 》WP Featherlight 是一個 WordPress 外掛,可為您的WordPress 網站添加一個極簡、高效、響應式 jQuery 燈箱。在其核心,WP Featherlight是一個用於 Featherlig...。
  • Phoenix Media Rename 》通過使用「Phoenix Media Rename」外掛,將您的媒體檔案重新命名,極大地提高您的 SEO。, 在Phoenix Media Rename 官方頁面上提供了完整的使用和設置指南。。

文章
Filter
Apply Filters
Mastodon