[WordPress] 外掛分享: Mmm Simple File List

首頁外掛目錄 › Mmm Simple File List
WordPress 外掛 Mmm Simple File List 的封面圖片
⚠ 此外掛已下架 — 不再更新維護,建議勿安裝。
2,000+
安裝啟用
★★★★
4.7/5 分(19 則評價)
1479 天前
最後更新
0%
問題解決
WordPress 3.4+ v2.3 上架:2014-09-17

內容簡介

這是一個簡單的外掛,使用簡碼 [MMFileList /] 列出指定目錄中的文件。

參數:

folder:相對於 WordPress 安裝的基本上傳目錄 (例如 siteurl.com/wp-content/uploads/mm/yy/、siteurl.com/wp-content/ 或 siteurl.com/media)。您可以從 WordPress 控制台的「設定」-「媒體」中檢查媒體設置。如果您將上傳文件組織在 WordPress 默認的按月/年的基本文件夾中,則應在上傳文件之前在此字段前添加「/../../」或禁用該設置。
format:表格格式 (format=”table”)、無序列表格式 (format=”li”)、逗號分隔格式 (format=”comma”)、圖像無序列表格式 (format=”img” 注:這樣會將所有文件都放在 img 標籤中) 或自定義格式 (format=”custom”,可使用簡碼內容創建自定義模板,請參閱下面的自定義格式部分以瞭解更多信息)。
types:僅列出指定文件類型 (例如 types=”pdf,doc,txt”),如果未指定類型,則將列出目錄中的所有文件。
class:僅用於「li」、「img」和「table」格式,將一個給定的類應用於簡碼輸出 (例如 <ul class=”mmm-list”>,有關樣式的更多信息,請查看常見問題)。
limit:默認值將列出目錄中的所有文件。您可以添加您選擇的正數,並顯示該數量的文件。
orderby:當前參數可以是「name」(默認值) 或「date」,根據修改日期對文件進行排序,因為創建日期似乎時好時壞。
order:默認情況下,列表的順序是按照從最高值到最低值 (desc) 的方式進行排序,其中「value」是由「orderby」屬性決定的。按日期排序會顯示最新的文件,按名稱排序會遞歸地列出,反轉這兩個默認值只需將 order=”desc” 添加到簡碼參數中。
target:此參數可讓您為列出的文件連結設置「目標」(通常用於在新窗口中打開文件)。
prettyname:此功能將底線和破折號替換為空格,並從文件名中刪除文件擴展名。
removesize:此功能從默認輸出中刪除文件大小。
removeextension:此功能刪除文件擴展名 (保留底線和破折號)。
regexstrip:像巫師一樣神嗎?何不輸入自己的正則表達式以刪除您想要的內容 (不提供保修,使用正確的格式,例如 regexstrip=”/e/” 將替換文件名中的所有 e!)。
regexreplace:想將該內容替換為其他內容而不是空格?在這裡添加您想使用的任何內容以與 regexstrip 函數一起使用。
regexfilter:過濾掉與給定的正則表達式模式匹配的文件名 (有關更多信息,請參閱使用示例)。
regexfilterinclusive:不是挑選幾個要排除的文件,您可以使用此參數來包括任何您想要包括的文件(有關更多信息,請參閱使用示例)。
dateformat:調整自定義模板中的 {date} 變量的格式。
headings:透過輸入逗號分隔列表調整表格格式的標題。
usecwd:如果無法使 wp_upload_dir() 文件夾正常工作,可以嘗試將其設置為 true,以使用當前工作目錄,而當前工作目錄應該是您的 public_html 文件夾。

輸出:

對於所有 HTML 格式,您可以期望看到以下包裝在可樣式化的容器中的輸出:

文件名 (連接到文件 URL)

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.3) 或搜尋安裝

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

原文外掛簡介

This is a simple plugin to list files in a given directory using this shortcode: [MMFileList /].
Parameters:

folder: Relative to the base uploads directory of your wordpress install (e.g. siteurl.com/wp-content/uploads/mm/yy/ or siteurl.com/wp-content/ or siteurl.com/media). You can check your media settings from your WordPress dashboard in Settings -> Media. If you organize your uploads in the WordPress default month / year base folder you should either prepend this field with “/../../” or disable that setting before uploading files.
format: Tabular (format=”table”) or Unordered list (format=”li”) or comma-delimited (format=”comma”) or Unordered List of Images (format=”img” Note: this will put all files in tags) or Custom (format=”custom”) for using the Shortcode content to create a custom template (see Custom Formats section below for more information)
types: Only list given file types (e.g. types=”pdf,doc,txt”), If no types are specified then all files in the directory will be listed.
class: Only used for the “li”, “img” and “table” formats, applies a given class to the shortcode output (e.g.

    / for more information on styling check out the FAQ)
    limit: The default value will list all files in the directory. You can add a positive number of your choice and that amount of files will be displayed.
    orderby: Current params can be either “name” (default) or “date” which sorts the files by date modified since date created seems to be hit and miss.
    order: By default the order of the list is sorted descending (desc) from the highest value to lowest where value is determined by the “orderby” attribute. Ordering by date results in a list being displayed as newest to oldest and ordering by name results in a list descending through the alphabet (a-z). To reverse either of these defaults simply add order=”desc” into the shortcode parameters
    target: This parameter lets you set a “target” for the links to the listed files (This is typically used to open the files in a new window)
    prettyname: This replaces underscores and dashes with spaces and removes the file extension from the filename.
    removesize: This removes the filesize from the default output
    removeextension: This removes the file extension (leaving underscores and dashes)
    regexstrip: Feeling like a wizard? Why not put in your own regex to strip out whatever you want from the filenames (no warranty provided, use proper formatting e.g. regexstrip=”/e/” will replace all e’s in the filename!)
    regexreplace: Want to replace that content with something other than a blank space? Add whatever you want here to work with the regexstrip function
    regexfilter: Filter out filenames that match a given regex pattern (See usage examples for more info)
    regexfilterinclusive: Instead of picking out a few files to exclude you can use this to parameter to include anything that you want (See usage examples for more info)
    dateformat: Adjust the format of the {date} variable in custom templates
    headings: Adjust the headings of the table format by entering a comma delimited list
    usecwd: If you can’t get the wp_upload_dir() folder to work you can try setting this to true to use your current working directory instead which should be your public_html folder

    Output:
    For all html formats you can expect to see the following output wrapped in styleable containers:

    Filename (linked to the File Url)
    File Size

    At this point “comma” is the only available text output and it only outputs the url to the file in a comma delimited list (no links – just text).
    If the folder you’ve entered isn’t found or there are no files with the extensions you’ve listed there will be some warning text output to let you know. This text is wrapped in a “mmm-warning” class in case you want to style it out (for more information on styling check out the FAQ)
    Usage Examples:
    Let’s say you’re using the default WordPress Media settings so we can expect your uploads folder to be in /wp-content/uploads/mm/yy/ with this in mind the shortcode “folder” attribute will look in a directory relative to this. With this base directory say we want to list “png” files in the folder “/wp-content/uploads/cats/” we would use the following shortcode:
    [MMFileList folder=”/../../cats/” format=”table” types=”png” /]
    If you have you disabled the setting to store uploads in the /mm/yy/ folder structure (you can do this within Settings -> Media) and wanted to display that same file you would use this shortcode:
    [MMFileList folder=”/cats/” format=”table” types=”png” /]
    This will result in a tabular list of all .png files in the /wp-content/uploads/cats/ folder.
    Custom Formats
    The “li” and “custom” formats allow you to define a template using the content portion of the shortcode. The difference between these two output formats is that “li” will still wrap all the output in a

文章
Filter
Apply Filters
Mastodon