How To Create A Custom WordPress Document Library (2023)
September 19, 2018
Searching for a solution to create a WordPress document library?
Unfortunately, WordPress doesn’t really have any core functionality to create a scenario where visitors are able to browse, filter, and/or download documents like PDFs, images, etc. It also only lets you add documents directly to the WordPress Media Library, which is difficult to manage because they’re mixed up with other files such as images.
But – as is often the case with WordPress – a WordPress document library plugin can step in to save the day.
In this post, I’m going to show you step-by-step how you can create your own flexible WordPress document library.
Because this method is so flexible, you’ll also be able to tweak your document library as needed to include more information or make things even more stripped down. You can even add filter dropdowns, file type icons, embedded audio, and video players.
To build your WordPress document library, all you’ll need is a little bit of your time and $79 from your wallet. I’ll show you how to do everything else!
Why Document Library Pro Is The Best WordPress Document Library Plugin
It lets you add documents and display them on your WordPress site in searchable, sortable tables with filters. That’s all you need to create a WordPress document library – even if you have thousands of documents!
Advanced Document Management
This WordPress document library plugin lets you:
Add and import documents. You can add them one at a time (just like adding a blog post in WordPress) or import them in bulk.
Manage documents. They appear in a special ‘Documents’ area in the WordPress Dashboard, so you can easily manage them away from your other Media Library files.
Supports all file types and 3rd party platforms. The document library plugin supports literally every file type. You can either store documents in the WordPress database, or link to documents that are stored externally – for example, on Dropbox, Microsoft SharePoint, or even YouTube videos.
Interactive Front End Document Libraries
Once you’ve added your documents, it’s easy to list them on your WordPress site:
Control exactly what information is displayed in your library. For example, you can add a document reference number, publication year, file size, file type, or anything else.
Include sort and filtering options. For example, you can let users filter by document tags or categories.
Add an AJAX search form. Let visitors search your document library without even having to reload the page.
Quick download links. Users can click a download button, text link, or file type icon to download the document – or access documents stored on a third-party URL.
Flexible document library layouts. You can list documents in a single table, or as a series of clickable folders that match your category and sub-category structure.
Create separate document libraries for different categories. You can create multiple document libraries and control exactly which files show up in each library for easy WordPress document management. This is useful if you want a separate page for Documents, Resources, Case Studies, Publications, and so on.
Individual document pages. The document library plugin automatically creates an individual page for each document. This displays extra information about the document, or you can disable it if it’s not required.
Supports audio, video, and other embedded content. Document Library Pro is about more than just displaying downloadable documents. You can also display other types of resources including WordPress audio libraries with embedded music players, or video galleries with embedded videos. It even works with other third-party embedding plugins, such as Google Drive embeds, PDF embeds, or flipbook plugins.
Basically, the plugin to lets you create a document library that’s unique to your needs. This is better than forcing you into a pre-configured setup like some WordPress document management solutions.
Video Tutorial (Sneak Peek)
Ok, hopefully, I’ve convinced you that it’s at least worth checking out the rest of this tutorial. Now, let’s get into the hands-on part and I’ll actually show you step-by-step how to go about setting up your own WordPress document library. If you prefer a video tutorial, here’s an in-depth one from Barn2.
Step-By-Step: How To Create A WordPress Document Library
There are three core parts to creating your document library:
Get all the tools you need
Prepare the custom fields you’ll need for your documents
Add or import your documents and other resources
Create your document library
Display your document library on your website
Here’s how to perform each part in detail…
Part 1: Install The Document Library Pro WordPress Plugin
Once installed, go to the settings page at Documents → Settings and activate your license key. You can get this from the order confirmation page or email.
In the ‘Document Fields’ section of the page, enable whichever fields of information you plan to store about your documents. If you want any additional fields – such as ‘Publisher’ if you’re listing books – then you can install a free plugin such as Custom Post Type UI. Use it to add extra fields to the ‘Document’ post type:
Custom fields. Use these for storing unique data about each document, such as a reference number or ID.
Custom taxonomies. Use these for storing information that you will use to group documents, such as ‘Publisher’ or ‘Year’. If you add these as taxonomies then you can display them as filter dropdowns above the document library so that users can filter by them.
Tip: You don’t need to create custom fields for file type, file size, date, or modified date. The document library plugin can calculate and display these for you automatically!
Don’t worry about the ‘Document Libraries’ tab of the plugin settings page for now. We’ll look at that page in more detail in Part 3 after you have added some documents.
Now, it’s time to add your documents to the library. This is pretty simple – it’s just like writing a regular WordPress blog post! There are also several ways to import documents in bulk, and I’ll tell you about these too.
Adding Documents Individually
Go to Documents → Add New in your WordPress dashboard. You should see what looks like the regular WordPress Editor.
Here’s how to properly upload a document:
Put the document’s title in the regular Title Area.
Add a short description for the document in the regular post editor area. You can also use this space to embed resources, such as audio or video players. This will appear as the ‘content’ column in the document library (if you include this in the library), and also on the single document page.
Add a brief excerpt, if required.
Add a Document Link – either by uploading a file directly to WordPress or by linking to a third-party URL such as Google Drive. If you’re just embedding the document onto the page and don’t need a download link, then select ‘None’.
Select categories and tags. These help to structure the document library and make the documents easier for people to find.
Enter any custom fields or taxonomies (if you’re using any).
Now, you just need to repeat the process to add all the documents you want to include in your document library.
The Document Library Pro plugin provides 3 ways to import multiple documents at once:
Convert Media Library files to documents. This is useful if your documents are already saved in the WordPress Media Library. Go to the Media section of the WordPress Dashboard, tick all the documents (ignoring other files such as images), and open the Bulk Actions dropdown list. Choose the ‘Add to Document Library’ option. This will add all of the selected files to the ‘Documents’ section of the WordPress Dashboard, where you can edit and add the information about each one.
Drag and drop file upload. Go to Documents → Import and use the drag and drop file uploader. This adds each file to the ‘Documents’ section, using the filename as the document title. You can then edit this and add extra information about each document.
CSV upload. This is the most comprehensive way to upload documents in bulk. You’ll definitely want to use this method if you have hundreds or thousands of documents. Prepare a CSV file with a column for each piece of information that you want to display in the document library. Include the URL of wherever the file is stored.
Once you’ve added items to the document library, you can start displaying them on the front end of your WordPress site.
Part 3: Create Your Front End Document Library
You’re almost at the finish line! Now, you just need to use Document Library Pro to create your front-end WordPress document library.
To configure the display of your document libraries, go to Documents → Settings. In this interface, you can configure the default settings for each document library on your site (you can always override these settings manually using shortcode parameters):
Pay particular attention to these document library options:
Columns. This option controls which information appears in the document libraries.
Document links. These options control the download buttons which appear in the ‘links’ column. You can display these as text links, buttons, or file type icons. There are also options to control the link behavior, and whether to let people access the single document page.
Filters. Choose the Custom filters option and add doc_categories, doc_tags. This will display filter dropdowns above the document library so that users can filter by category or tax. If you’ve added any custom taxonomies then you can add filters for these too – just add tax: before the taxonomy name.
The Document Library Pro plugin has everything you need to list documents or any other type of resource in WordPress. This is perfect for nearly all types of document libraries.
Barn2, the company behind the plugin, has extensively tested Document Library Pro with many other plugins. You can use it with other plugins to add even more features to your document libraries. The possibilities are endless, and here are some examples.
Private Document Libraries
You can use Document Library Pro on a private staff intranet that only your organization can access.
If your intranet is already private, then simply install Document Library Pro as it comes. It will be protected under the structure of the rest of your intranet.
Alternatively, you can use Document Library Pro with membership or password protection plugins to restrict the document library part of your site. For example, you can do this with Barn2’s Password Protected Categories plugin. Document Library Pro also works with most WordPress membership plugins.
How to Track Document Downloads
I expect that like most WordPress users, you already have Google Analytics installed on your website. You can easily extend this to track the number of people who download each document from the library.
Some WordPress document libraries need their users to be able to upload documents without having access to the WP Dashboard. This might be other staff within your organization, or it might be the general public.
Either way, you can do this by using Document Library Pro with the Gravity Forms plugin. Create a ‘Submit Document’ form on the front end of your website (either on a public or a private page). Users submit files, which are then added to the document library.
You might want people to be able to edit items in the WordPress document library from the front end too. You can do that by using Document Library Pro with the WP Sheet Editor plugin.
The way it works is that you add an ‘Edit’ button to your document library pages. You can either show this to everyone, or to specific user roles only (e.g. so that your employees can see it). When they click the button, the document library opens in a spreadsheet-style table so that you can edit the content in each cell.