Installation
- The plugin is available for download on the WordPress repository,
- Once downloaded, uncompress the file eg-attachments.zip,
- Copy or upload the uncompressed files in the directory wp-content/plugins in your WordPress platform
- Activate the plugin, in the administration interface, through the menu Plugins
The plugin is now ready to be used.
You can also install the plugin directly from the WordPress interface.
Then you can go to menu Settings / EG-Attachments to set plugin parameters
This plugin was tested on WordPress 3.1, and up to 3.3.1.
Update
When a new version is available, options of the plugins are updated during the activation.
So during the upgrade procedure, please desactivate / reactivate the plugin, in order to ensure that options are properly modified.
Usage
Four ways to include the list of attachments into a post:
* With the paper clip button in TinyMCE bar. Click on this button, choose the options, and click insert,
* With the shortcode [attachments options ]
* With the automatic shortcode: go to the Settings / EG-Attachments, and choose to activate the auto-shortcode. The list of attachments will be added to your post automatically.
* In a template file, add the following code: <?php do_shortcode('[attachments *options*]'); ?>
Since 1.7.4, the plugin can display, in the admin interface, the list of attachments of the post being edited. Go to Settings / EG-Attachments, chapter Administration Interface for further details.
The shortcode options are:
- size: size of the icon. Values: large, medium, small or custom. Default: large,
- doctype: type of documents to display. Values: image or document. Defaults: document,
- docid list of attachments' id (comma separated) you want to display. Default: nothing to display all attachments,
- id: id of the post we want to display attachments
- orderby: sort option. Values: title, caption, description, file name, size, date, type, menu_order and ASC or DESC.
ASCis the default sort order. Default: title ASC.
- title: title to display before the list. Default: '',
- titletag: tag to add before and after the title. Default: h2
- label label of each document. Values: filename, doctitle. Default: filename. Option available for size=small or size=medium only.
- fields, list of fields to display. Values: Document label, Title, Caption, Description, File name, Size, Small size, Date, Type, or a set of values such as "caption,description" (comma separated).
- force_saveas forces the browser to show the dialog box (Run / Save as) rather than display attachment. Values: true or false. Default: the default value is defined in the Settings page in administration interface.
- icon specify if icons will be displayed or not. Default value: 1 or TRUE. If value is 0 or FALSE, list displayed will be ul/li (html simple list) rather than dl/dt/dd (definition list).
Two specific keywords can be used with docid option: first and last allow to display the first and the last attachment of list. Be careful, first or last can change according the sort option ! These keywords must be used alone. You can have syntax such as: first,10,11.
- limit: choose the number of attachements you want to display. Default: all attachments are displayed
- nofollow: add the attribut "nofollow" to the link, if value is set to 1 or TRUE. Default nofollow=0
- display_label: for size=small only. Allow to display label of fields, when value is set to 1. Default display_label=0
- logged_users authorizes access to the file, to logged users only, or to all users. Possible values: 0, all users can visualize or download attachments, and 1, only logged users can access to attachments. Default value: the default value is defined in the Settings page in administration interface.
- tags allows you to select attachments according tags (post tags). Syntax: tags=tag1,tag2.
Example 1: [attachments size=medium doctype=document title="Attachments" titletag=h2 orderby="title"]
Example 2: [attachments size=large title="Documents" titletag=h3 orderby="mime DESC"]
Example 3: [attachments title="Books and DVD Reviews" orderby="date DESC" tags="books,dvd"]
Some explanations about *General behavior of shortcodes
In the menu Settings / EG-Attachments, you will find a section named General behavior of shortcodes.
The options in the section are
- applied to all shortcodes (automatic or manually inserted into posts),
- used as options for the automatic shortcode,
- used as default value for the shortcode manually inserted into posts.
Example: if you check the option Force "Save As" when users click on the attachments, you force download for all attachments displayed by auto-shortcodes, and manual shortcode, except if you specify force_saveas in a shortcode option.
The defaults parameters of auto-shortcode are:
- Small size: label, size,
- Medium size: label, caption, size,
- Large size: title, file name, caption, size.
Where label is: title or file name according selected option.
Statistics
Just activate the clicks counter in the menu Settings/EG-Attachments, and then go to the menu Tools / EG-Attachments statistics to see how many clicks you have, for each document.