Select Page

Every Statistics Office website have a few features in common, one of them (and probably the most important) is the document library where you share reports, spreadsheets, and all kinds of documents with your users.

Most CMS, WordPress included, are not be very good at document management by default. Luckily we can use the WP File Download plugin (WPFD) to improve this and share documents online in a convenient way.

Introducing the WP File Download plugin

This plugin is developped by JoomUnited, as a few other plugins we use on NSO websites.

While the title suggests that this is only about downloading files, it does include real document management features, such as:

  • Organize files in folders
  • List files in pages and posts
  • Full text search within documents
  • Documents download statistics

Organize files in folders (or categories)

The first thing you need to do is to create folders in a similar way you would when organizing your files in your hard drive.

WPFD uses the term “categories” instead of “folders”. This actually makes sense, because you would most probably create the same file categories as the post categories you have previously defined (learn more about WPFD and post categories).

Creating categories is pretty straight forward: simply go to the WP File Download page in your WordPress backend, and hit the “NEW” button on the left to create new categories.

You can reorganize categories in sub categories by simply dragging and dropping them in the list.

List files in a page or post

Let’s say you have a set of pages, based on more or less the same layout, where you defined a area to list all files related to each page.

For example, let’s create a page about Census 2010. In this page you would want to list all reports and spreadsheets related to this Census.

This is easily done with the WPFD plugin by creating a category for Census 2010, and load all documents under that category.

Using Gutenberg editor, you then just need to add a WP File Download Category block, and select the said category:

What this actually does is simply calling a shortcode which will generate the list of documents.

Using the Divi Page Builder, you will need to add the shortcode manually as there is no specific block for this.

First thing to do is to get the shortcode. To do so:

  1. In WP backend, go to WP File Download main page
  2. Click on the category you would like to display
  3. From the right hand side panel, copy the shortcode (which includes the id parameter corresponding to the category)

In your page, add a Code module and paste your shortcode.

List latest uploaded files

When displaying a list of files, you usually want them to be ordered alphabetically.

The default order behavior is defined in the backend, for each category.
(click on the name of a category on the left column to see its options).

But in some cases you might want to show a list of the most recent uploaded documents. You will need to add specific parameters to the shortcode to do so:

  1. In the WordPress backend, go to WP File Download > Configuration page
  2. Click on “Single File” item from the left menu
  3. Select your options in the “Category Shortcode Generator” and copy the generated shortcode
  4. Paste your shortcode in your page or post

The NSO Theme also provides an alternate shortcode to display the list of recent documents by category, or in the whole document library:

To list the 5 most recent documents:
[nso_recent_documents count="5"]

To list the most recent documents for a specific category, including all sub categories:
[nso_recent_documents cat_id="24" include_sub_categories="1"]

If you use category pages, you may also list all recent files by editing the post category, as explained in the post about NSO Theme and category pages. In this case there’s no need to write any shortcode, it is generated automatically.

Search and browse files

One last thing you certainly would like to have on your website is a page where your users can easily find any document available on your website, either:

  • By searching documents using keywords
  • By browsing all documents, organized in folders/categories
  • Listing latest released documents

Here’s an example of such a page in the training website:
http://training.nso.spc.int/documents/

This page simply includes 3 shortcodes:

  • Search form
  • List files per categories (using the tree theme)
  • List latest files uploaded

To define the “search form” shortcode, go to WP FIle Download > Configuration page in the WordPress backend, and click on “Search & Upload” item from the left menu. Use the Search Engine Shortcode Generator to create your search form according to your preferences, then copy and paste the generated shortcode in your page.

Full documentation

The WP File Download plugin has lots of options, providing different “themes” to list files using different layouts, allowing you to select what meta data you want to display (title, date of upload, number of downloads, etc.).

To learn more about the WP File Download plugin and all its options, read the complete documentation on JoomUnited website.