
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.9.1 |
Plugin version: | 2.1 |
Added to WordPress repository: | 18-09-2014 |
Last updated: | 28-12-2017 |
Rating, %: | 92 |
Rated by: | 17 |
Plugin URI: | http://www.mediamanifesto.com |
Total downloads: | 11 241 |
Active installs: | 2 000+ |
![]() Click to start download |
Screenshots
FAQ
Installation Instructions
- Download and install the plugin from WordPress dashboard. You can also upload the entire “MmmFileList” folder to the
/wp-content/plugins/
directory - Activate the plugin through the ‘Plugins’ menu in WordPress
Why should I use this plugin?
Say you have a folder on your webserver with 30 files you want to list but you don’t want to tediously write out the html, load them as media to your WordPress site or edit your htaccess to allow directory listing. This would be the ideal case to have a quick and dirty solution that handles updates to files without additional work on your part.
Are there other output formats available?
Not at this time. If you want to request them via the forums here then I can have them added fairly quickly.
Why not have a settings page or upload functionality?
The idea behind this plugin is to be really simple and not mess with your site. The plugin file itself is designed so that you could just copy / paste it into your functions.php and it would run without even needing to worry about a plugin. If you are looking for a full featured file manager you should take a look at File Away.
How can I style the list with the class I’ve added?
If you have admin access to your site or your theme allows you to add custom styles you can add CSS for the classes you’ve added into there.
Example:
If you want to remove the warning text that is output when folders / files are not found you can add the style:
.mmm-warning {display: none;}
The “img” format keeps trying to display non-images, what gives?
The “img” format outputs all files in
blocks so if you have non-image files in the same directory I recommend using the “types” parameter to specify only images should be displayed then include a second shortcode to include all the non-image types you want to display.
2.1
- Updated constructor so it is no longer deprecated
2.0
- Refreshed to let WP.org know this plugin still works!
1.9
- Added headings parameter which allows us to customize the headings row on a table with a given bulleted list
- Added hooks for custom table value templates based on the shortcode content, users can now add a series of tags which will be wrapped in a while building the table
1.8
- Added date modified as an available template parameter using the {date} markup
- Added file extension as an available template parameter using the {ext} markup
- Added a “prettyname” parameter to the shortcode which strips dashes, underscores and the file extension when set to “true”, replaces them with spaces, adds spaces between uppercase characters and then trims everything nicely
- Added a “regexstrip” parameter to the shortcode which strips away characters based on a given regex string from the user (Note: will throw errors if the regex isn’t properly formatted!)
- Added a “dateformat” parameter for adjusting how the date modified variable appears
- Added an output format called “li2” which renders the name date and extension parameters in an unordered list
1.7
- Changed default order setting to be labeled as “ascending|asc” instead of “descending|desc”
1.6
- Added “order” parameter
1.5
- Bug fix for orderby date code
1.4
- Bug fix for tabular list target and class vars not being passed through correctly.
1.3
- Updated human_filesize function to work according to the standardized International System.
1.2
- Fixed bug with array_map usage in 5.2.17
1.1
- Fixed missing break; in the format switch
1.0
- Added hooks for shortcode content to customize output of some templates
- Added a “custom” output format for use with the content hook
- Organized the code and updated some comments to reflect the hook change
- Added some “borrowed” code to fix the empty
<
p> tag issue common with WordPress shortcodes
0.7
- Added “img” output format to create an Unordered List of Images.
- Changed code so all files in the directory will output if no types are listed (this may annoy some people but it makes the experience much friendlier for new people).
0.6a
- Added slightly more robust path code so trailing / preceeding slashes aren’t so tricky to work with. e.g. say you want to load files from a folder called “cats”. You can now simply have folder=”cats” instead of having to include the first slash “/cats” and having to avoid using the trailing slash “/cats/”. Any variation should work along with handling of cases when too many slashes are added “//cats//”.
0.6
- Reworked how the class parameter is passed through the code so more information can be sent along with it
- Added the option to include target for the links using the aforementioned method
0.5
- Added limit and orderby params to the shortcode
- Changed the code to check if the directory exists before trying to get the files (this fixes the issue with warning messages from being displayed while having debug mode enabled)
0.4
- Added some output to show if the folder was not found or if there were no files of the given extension(s) found in the directory
- Note: These new messages are wrapped in divs with a “mmm-warning” class so they can be styled to be hidden.
0.3
- Added “table” output format
- Added “filesize” to information that is output (this should automatically format to the nearest reasonable size B,K,M,G etc..)
- Adjusted how the file array is built so it’s more extensible
- General Code Cleanup (naming changes, readibility prioritized over condensed & dehydrated code)
0.2
- Fixed a bug related to folders within the given path
- Updated support docs and plugin description to show that folder is the base uploads directory and not the base directory.
0.1
- Initial release to WordPress.org