Mmm Simple File List

plugin banner

Plugin to list files in a given directory using a basic shortcode.

Author:Adam Bissonnette (profile at wordpress.org)
WordPress version required:3.4
WordPress version tested:4.1.7
Plugin version:1.9
Added to WordPress repository:18-09-2014
Last updated:26-08-2015
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:90
Rated by:15
Plugin URI:http://www.mediamanifesto.com
Total downloads:6 091
Active installs:1 000+
plugin download
Click to start download

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. <ul class="mmm-list"> / 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 (asc) 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)

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 <ul> tag and each file will be wrapped in a <li> tag. Here is an example of how to create a custom template:

[MMFileList folder="/cats/" format="li"]<div class="taco"><a href="{url}">{name} ({size})</a></div>[/MMFileList]

Variables that can be used with the custom templates are as follows:

  • {name} - This will output the filename
  • {size} - This will output the filesize
  • {url} - This will output the file url
  • If you would like more information available to be output don't hesitate to a send in a request via the support forum


Screenshots
FAQ
ChangeLog