前言介紹
- 這款 WordPress 外掛「Random File」是 2004-12-20 上架。
- 目前有 90 個安裝啟用數。
- 上一次更新是 2025-04-08,距離現在已有 25 天。
- 外掛最低要求 WordPress 2.8 以上版本才可以安裝。
- 有 1 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
file | files | random | randomize | coffee2code |
內容簡介
此外掛提供模板標籤,允許您檢索指定目錄中隨機選擇的文件名稱、路徑(相對或絕對)、URL,或完整標記的鏈接。
函數的參數允許您根據給定的文件擴展名限制可以隨機選擇的文件。您還可以明確指定不應隨機選擇的文件。這個功能可用於顯示隨機圖像/標識或將來自隨機文件的文本包含在您的網站上(寫作摘要,多行引用等)。其他想法:隨機廣告,隨機CSS文件,隨機主題模板選擇。可以在“the loop”內外運行。
注意事項:
如果要實際顯示隨機文件的名稱,請確保“echo”結果。
除非通過“$extensions”參數將文件搜索限制為僅包括特定擴展名,否則指定的“$dir”中的所有文件都將被考慮為隨機選擇。
可以在“the loop”內外運行。
鏈接:插件主頁 | 插件目錄頁面 | GitHub| 作者主頁
模板標籤
此外掛提供了兩個可選的模板標籤,可用於您的主題模板。
函數
此函數從指定目錄中檢索隨機文件的名稱,並根據$reftype值返回文件相關信息。
此函數從指定目錄中檢索指定數量的隨機選擇文件的名稱、路徑或鏈接。除了$number參數,其餘參數都會被傳遞到c2c_random_file()。
參數
$number(僅限於c2c_random_files())
要從指定目錄中選擇的隨機文件數量。如果指定目錄中存在少數文件,則將返回目錄中的所有文件(但會以隨機順序列出)。
$dir
要檢索隨機文件的目錄。該目錄必須存在於您的WordPress安裝的文件夾結構級別或以下。 (即,如果您的站點在伺服器上安裝在/usr/local/htdocs/example.com/www/journal/,則您指定的隨機文件目錄將假定其為基礎...因此,對於值'randomfiles',將假定實際上是:/usr/local/htdocs/example.com/www/journal/randomfiles/)
$extensions
可選參數。以空格分隔的擴展名列表(不區分大小寫),即'jpg gif png jpeg'。
$reftype
可選參數。可以是以下之一:'相對'(默認值)、'絕對'、'url'、'filename'、'hyperlink'。有關詳細信息和範例,請參見示例部分。
$exclusions
可選參數。如果指定,必須是要從考慮中排除的文件名數組。
原文外掛簡介
This plugin provides template tags that allow you to retrieve the name, path (relative or absolute), url, or fully marked-up link to a randomly chosen file or files in a specified directory.
Arguments to the functions permit you to limit what file(s) can be randomly selected based on a given set of file extensions. You can also explicitly specify files that should not be randomly selected.
This functionality can be useful for displaying random images/logos or including text from random files onto your site (writing excerpts, multi-line quotes, etc). Other ideas: random ads, random CSS files, random theme template selection.
Notes:
If you want to actually display the name of the random file, be sure to ‘echo’ the results:
Unless you limit the file search to only include a particular extension (via $extensions argument), all files in the specified $dir will be under consideration for random selection
Can be run inside or outside of “the loop”
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Developer Documentation
Developer documentation can be found in DEVELOPER-DOCS.md. That documentation covers the template tags and hooks provided by the plugin.
As an overview, these are the template tags provided by the plugin:
c2c_random_file() : Retrieves the name of a random file from a specified directory and returns information based on the file.
c2c_random_files() : Retrieves the name, path, or link to a specified number of randomly chosen files in a specified directory.
These are the hooks provided by the plugin:
c2c_random_file : Filter to safely invoke c2c_random_file() 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.
c2c_random_files : Filter to safely invoke c2c_random_files() 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.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Random File」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.0 | 1.5 | 1.6 | 1.7 | 1.8 | 2.0 | 1.5.1 | 1.5.2 | 1.6.1 | 1.6.2 | 1.7.1 | 1.8.1 | 1.8.2 | 1.8.3 | 1.8.4 | 1.8.5 | 1.8.6 | 1.8.7 | 1.8.8 | 1.8.9 | 2.0.1 | trunk | 1.8.10 | 1.8.11 | 1.8.12 |
延伸相關外掛(你可能也想知道)
Post-Plugin Library 》Post-Plugin Library 是一個共享代碼庫,並沒有獨立的功能,必須安裝它才能為 Similar Posts、Recent Posts、Random Posts、Popular Posts 和 Recent Comment...。
Randomize 》Randomize 外掛可以顯示隨機的文字,您可以在管理後台按類別輸入文字、引文和 HTML 代碼。您可以使用小工具、shortcode 或模板標籤顯示網站上的隨機內容。, ...。
Related Products for WooCommerce 》ure of Jetpack for a more advanced and customizable solution., 此外,Related Products for WooCommerce 也支援多國語言。, , 此外,提供以下功能:, , ...。
Random Post Plugin – Redirect URL to Post 》重定向您的訪客到:, , 隨機文章, 您最新的文章, 您最舊的文章, 前一篇或下一篇文章, 或一組條件的組合,例如最新的10篇文章中的隨機文章,至少3個月前的最新...。
Random Text 》RandomText 是一個方便的 WordPress 外掛,可以讓你保存、編輯和刪除分類文本,並通過小工具將隨機/旋轉的文本按類別注入側邊欄或通過模板標籤注入頁面正文。...。
Random Content 》此外掛允許您使用縮略語或小工具在您的網站任何位置顯示隨機內容。您可以將您的隨機內容分組,讓您在網站中的多個位置顯示不同的內容。, 透過自訂的文章類型...。
Random Post for Widget 》這個簡單的外掛是一個小工具,可以在您的側邊欄上顯示一個隨機文章清單。您可以通過文章 ID 排除某些文章。, 緊急修復, 某位使用者發現了一個小問題,文章狀...。
WP Bannerize Pro 》WP Bannerize Pro 是一個出色的橫幅管理器。使用 WP Bannerize,您可以透過小工具、簡碼或直接從您的模板管理所有廣告內容。, 1.6.5 中的重要更新, 若要繼續...。
WooCommerce Random Product Sorting with Pagination 》此外掛可以為 WooCommerce 增加「隨機」的商品排序,同時保留分頁瀏覽。, 我找到的其他解決方案增加了「隨機」的商品排序,但沒有保留分頁瀏覽。, 此外掛可以...。
Better Random Redirect 》這個外掛基於原始的隨機重導,可以實現有效、簡單的隨機文章重導。支援為所有隨機重導設定分類,短代碼生成可以覆蓋預設分類的 URL,以及設定自己的重導 URL...。
Random Posts 》隨機文章外掛(Random Posts)會顯示一個隨機選擇的文章列表,你可以在許多方面自定義輸出。, 此外掛需要最新版本的文章外掛庫: 現在下載。, 版本歷史, , 2....。
Random 》使用「Random」外掛,您可以在 WordPress 網站上插入一個或多個隨機內容,這些內容可以來自您的文章、頁面或自訂文章類型。, 您可以以多種不同的方式顯示資訊...。
Easy Quotes 》Easy Quotes 是一個讓你收集和顯示你喜愛的報價 / 評論 / 推薦或其他簡短文本片段的外掛,可以在你的網站上展示。, 主要功能:, , 自定義文章類型 "報價",可...。
XV Random Quotes 》XV Random Quotes 外掛可幫助您在 blog 的各處收集並顯示隨機引言。該外掛非常靈活,可用於顯示各種隨機詞語,例如標語、「回答一條留言」信息、頁腳或標題等...。
UploadPlus : File Name Cleaner 》新增功能:清理 EXIF 頭檔惡意程式/後門!, 在網路上,檔名與桌面上的不同,空白和奇怪的字元在網路上不適用。使用 UploadPlus,您可以在檔案上傳時設定規則...。