EG-Attachments: Documentation

EG-Attachments documentation

Installation / Update

EG-Attachments is a standard WordPress plugin. You can install it by using mainly two methods:

  • Manual method
    • You download the plugin HERE,
    • Uncompress the downloaded file into a local directory,
    • Copy or upload the uncompressed files in the directory wp-content/plugins in your WordPress platform,
    • Connect to WordPress administration interface, and activate the plugin
  • Automatic method:
    • In the administration interface of your blog, go to the menu Plugins / Add new,
    • Search the plugin with keywords like attachments, or EG-Attachments,
    • When you find it, click on the install button, and choose to activate the plugin

The plugin is now ready to be used. You can use it immediately, or go to the menu Settings / EG-Attachments to set plugin parameters.


Three ways on inserting the shortcode

EG-Attachments provides a shortcode to display list of attachments. You have three ways of using the shortcode:

  • Fully manual: you manually enter the shortcode in your post content,
  • Manual: the plugin includes an interface, integrated into the post editor, to choose the options of the shortcode, and insert it into the posts content,
  • Automatic: With a feature named « auto-shortcode », you can display the list of attachments, without inserting the shortcode in each involved post. Just activate the option, and the plugin will detect automatically the attachments, and then will display the list.

    TinyMCE integrated
Shortcode parameters

EG-Attachments has the same behavior than any other shortcode (like Gallery for example).
While editing your post, you enter the shortcode, with brackets around, and some parameters.
The syntax is the following:
[ attachments <parameter1>=<value1> <parameter2>=<value2> ... ... <parameter x>=<value x>]

Parameters defining display format are the followings

Parameters Description Default value
size Format of the list, and size of the icon.
Possible values: large, medium, small or custom.
orderby Sort option, with two components, the sort key and sort order. Please enclose these two components in  » . Exemple orderby= »caption desc ».
Possible values for sort key: Title, Caption, Description, File name, Size, Date, Type
Possible values for sort order: ASC or DESC (upper or lower case).
title ASC
title Title displayed before the list.  » (empty string)
titletag HTML tag to add before and after the title. Possible values: any HTML tag (like h1, h2, … or p, ) h2
icon Specify if icons is displayed or not. If icon is used, the shortcode uses dl/dt/dd (definition list). If the icon is not used, list will be ul/li (html simple list)
Possible values: 1 / TRUE or 0 / FALSE.
1 / TRUE
limit The maximum number of attachments to display. If limit is not specified, all attached files are displayed None
label Label of each document.
Possible values: filename, doctitle.
Option available for size=small or size=medium only.
fields List of fields to display.
Possible values: Document label, Title, Caption, Description, File name, Size, Small size, Date, Type, or a set of values such as « caption,description » (comma separated)
display_label (For size=small only) Allow to display label of fields, when value is set to 1.
Possible values: 1/TRUE or 0/FALSE.
For example, if display_label=1, we will have filename: my_file.xls. if display_label=0, we will have my_file.xls.

The defaults fields displayed are

  • Small size: Label, Small_size,
  • Medium size: Label, Small_size, and Caption,
  • Large size: Title, Caption, Filename, and Size.

Parameters to select or filter attachments are the following

Parameters Description Default value
doctype Type of documents to display.
Possible values: image or document
docid List of attachments’ ids (comma separated) you want to display. Two specific keywords can be used first and last allow to display the first and the last attachment of list. Be careful, the first or last attachment can change according the sort option ! These keywords must be used alone (cannot be used within a list of ids).By default all documents are displayed Nothing
tags Select attachments using (post)tags. This parameter is working only if attachments are linked to the (post)tags. You can link attachments and tags, with EG-Attachments, or any other tool (plugin, or theme feature). The syntax is tags="tag1,tag2, tag3". Nothing
id id of the post we want to display attachments. You need to use this parameter, if you want to display documents or images that are not attached to the post being displayed. Just give the id of the post that you want to display attachments, Noting (current post)

The following parameters define the behavior of the links displayed by the shortcode:

Parameters Description Default value
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.
1 (1)
nofollow Add the attribut « nofollow » to the link.
Possible values are 1 / TRUE or 0 / FALSE
force_saveas Forces the browser to show the dialog box (Run / Save as) rather than display attachment.
Possible values: 1 / TRUE, or 0 / FALSE. Default: the default value is defined in the **Settings page** in administration interface
0 (2)
target Add the attribut target= »blank » to the link.
Possible values are 1 / TRUE or 0 / FALSE
  1. logged_users. The default value is 1 in the initial setting of the plugin. But this default can be changed in the Settings page of the plugin,
  2. force_saveas. The default value is 0 in the initial setting of the plugin. But this default can be changed in the Settings page of the plugin.



To activate the statistics, go to Settings/EG-Attachments, and check Activate Statistics.

Activate statistics

You can exclude some sites (your test / dev platform for example) from the statistics, by specifying their IP addresses.

After some clicks, if you go to the menu Tools/EG-Attachments Tools, you can view the statistics.

Because of using cache, you can have, sometimes, some delays before seen counters increase after a click.
Statistics dashboard

Enhanced administration interface

You can improve the interface of WordPress by adding some items, with the following options:

Options for administration interface

Adding an EG-Attachments’ menu in the administration bar, gives a direct access to the options, and to the statistics,

Administration bar

Adding the metabox allows to display the list of attachments, directly in the editor page.

EG-Attachment metabox

The two other options add features in the media uplaod window: By activating these options, you can activate or close the comments on attachments, and you can link attachments to the tags.

Improve the media upload window

Manage styles

By default, the plugin is using its own styles. The stylesheet eg-attachments.css is located in the plugin directory.

You have two ways of modifying the styles:

  • Create your file eg-attachments.css in your theme directory. If the plugin finds this file, it will load it, rather than loading the default one,
  • You can include the customized styles into the stylesheet of your theme (styles.css). In this case, you have to uncheck the option Styles.

    Load stylesheet or not


Uninstall the plugin

If you wan to uninstall the plugin (desactivate and delete it), you need to follow the standard WordPress procedure (menu Plugins, link desactivate, and then link delete).

If you want to delete EG-Attachments data during the plugin deletion, you have to check the option Delete options during uninstallation.

Uninstallation option

By this way, all options, temporary data, and statistics will be deleted during the plugin deletion.


Partager cet article