How to Create a WordPress Document Library

Published on: January 29, 2018
Updated: May 7, 2019

A WordPress document library plugin presents your documents in an easy-to-find format. It makes document library management easier for you to keep things organized, share resources within your organization, create a resource hub or a publications database. Your WordPress document library might be public, or you can keep it private and available to specific people only.

It’s surprisingly hard to find a good WordPress document library plugin. There are lots of WordPress file management and media library plugins for admin, but very few can create a front-end document library for users. The ones that do exist have poor ratings and a lot of negative feedback.

This is where Posts Table Pro comes in. In this tutorial, I’ll explain 2 methods for how to use Posts Table Pro for document management and your WordPress media library. Both methods offer a fantastic way to create a WordPress document library.

Later, I’ll also share some tips on how to make your WordPress document library (or just parts of it) private and hidden from public view; how to allow your users to submit documents; and more.

WordPress document management: Step-by-step tutorial

First, watch me creating a WordPress document library using the first method described in this tutorial. Alternatively, keep reading for full written instructions:

Posts Table Pro – the perfect WordPress document library plugin

The Posts Table Pro WordPress plugin instantly creates interactive WordPress tables listing documents or items from your WP media library on one page. You can use it to list documents, PDFs, publications or any other type of document in a searchable, sortable table with filters. This makes it easy for people to find the documents they’re looking for and either read them online, or download a file.

Posts Table Pro

Before we start, check out this review from a happy customer. Then we’ll go through the steps of setting up a document library using a choice of 2 methods. Finally, we’ll check out an example of Posts Table Pro in use for a WordPress publications library.

2 easy methods to create a WordPress document library

Like what you see? Great! Next I’ll show you how to create a WordPress document library for your publications.

There are 2 ways to use Posts Table Pro to build a document library in WP. Choose the one that best suits the way you wish to store your documents:

Method 1 – Create a custom post type for your documents. With this method, you’ll create a special ‘Documents’ area in the left hand side of the WordPress admin, and use this to store information about your documents as well as download links. The downloadable documents are stored in the media library, but you’ll have a dedicated area of the WordPress admin to manage each document. This makes your documents easy to manage because they’re not mixed up with other types of file in the media library (e.g. the images from your web pages and blog posts).

With both methods, you can choose what information to display in the document library (summaries, file type, file size, category, etc.), and you can add links to download the document. Both methods support any file type, including PDF, JPG, DOCx, etc.

Choose Method 1 if you’d like a dedicated ‘Documents’ area in the WordPress admin where you can manage your documents. Choose Method 2 if your documents are already in the WordPress media library and you don’t want to have to create a separate post for each document.

Now you know which method to use to create your WordPress document library. Next, I’ll tell you how to set them both up.

Adding documents to your library – Next, you’ll create a ‘post’ for each document (either manually or using a WordPress import plugin). You’ll use this to store the document title and any additional information that you wish to display. If you’re adding downloadable documents, then you’ll upload the files to the WordPress media library and link to them from the post for each document. – Jump to instructions.

Step 1. Decide how to store your documents in the library

Posts Table Pro doesn’t store your documents for you – you have WordPress for that. Posts Table Pro’s job is to create a library of documents added to your WordPress website.

I’m going to cover everything you need to know about:

Creating a custom post type to store your documents

Adding extra document data

Storing documents as website content

Storing downloadable documents

Remember, if you just want to display media library files directly in the document library, then you can switch to Method 2 instead.

Posts, custom posts or pages?

The Posts Table Pro plugin supports standard WordPress posts, pages and custom post types. This means that you can create a WordPress document library using any of these methods:

Add each document as a post in the ‘Posts’ section of the WordPress admin.

Add each document as a standard Page in the ‘Pages’ section of the WordPress admin.

Create a custom post type called ‘Documents’, ‘Resources’ or similar. This means that there will be a ‘Documents’ or ‘Resources’ section in the left of the WordPress admin where you can store your documents.

Most people use a custom post type for their documents or resources, so that’s what we’ll do in this article. (If you’d rather use standard posts or pages, that’s fine – in step 3, simply select ‘post’ or ‘page’ from the Post Type dropdown on the plugin settings page.)

I’ll show you how to create a Documents custom post type using the free Pods plugin. I recommend Pods because you can also use it to create custom fields and taxonomies, which are perfect for storing extra data about your documents. However, you can use Posts Table Pro for WordPress document management, regardless of which plugin you use to store the documents. Other good options include Custom Post Types UI and Advanced Custom Fields. If you’re a WP developer, you can create a custom post type without using a plugin. But Pods is the only plugin I know that lets you create ALL the data you need with a single plugin!

Store extra data in custom fields and/or taxonomies

By default, your Documents post type will contain the same information as standard WordPress posts: title, content etc. But there’s lots of other information you might want to include in your WordPress document library. For example, you might want to divide it into categories, or store information about the publication date, file size or file type. You can store all this extra information in custom fields and taxonomies.

First, these tips will help you decide whether to store each piece of data as a custom field or taxonomy:

Custom fields – use these to store unique data about each item in your WordPress document library. For example if you’re using your document library to store internal publications, each one might have a unique document number. You would store the document numbers as a custom field.

Custom taxonomies – taxonomies are an opportunity to sort and organize data. Use these to store information that will apply to multiple documents in your library. For example, you might want people to be able to filter the document library to view documents from the year 2016. To do this, you would create a taxonomy called ‘Year’ and assign each document to the appropriate year.

You can also use standard WordPress categories and tags to store data about your documents. These also count as ‘taxonomies’ as each tag would be used for multiple categories and tags. The problem with these is that the built-in categories and tags will be shared across other content types, and not just your document library. For example, the same tags will be used for normal blog posts and documents. I recommend using custom taxonomies for these instead, as it keeps the data separate from the other parts of your website.

How to create a custom post type for your documents

When you create a custom post type to store the resources in your WordPress document library, it will appear as a separate link in the left hand side of the WordPress admin. You can call it anything you like, e.g. ‘Documents’, ‘Publications’, ‘Articles’ or ‘Resources’. You’ll add each document as a separate post in this section of the admin, and later display them as a document library.

On the left of the WordPress admin, go to Pods Admin -> Add New -> Create New.

Next, you’ll see the ‘Add New Pod’ screen. Choose ‘Custom Post Type’ from the ‘Content Type (like Posts or Pages)’ drop down list.

Choose a Singular and Plural label. This will appear on the left of the WordPress admin. For example, the Singular Label for a WordPress document library might be ‘Document’ and the Plural might be ‘Documents’.

Click the ‘Next Step’ button.

On the next screen, add as many custom fields as you like to the custom post type you just created. Remember – custom fields are for storing unique data about each document such as a document reference, file size or download link. Don’t use them for information that you want to be able to filter by – we’ll use taxonomies for this in a minute.

Next, go to the ‘Advanced’ tab and scroll down to the ‘Supports’ and ‘Built-in Taxonomies’ sections. Tick any fields you plan to use for your custom post type. For example, tick ‘Featured Image’ if your WordPress document library needs an image column. People often create a document library with images for either a ‘File type’ icon or to upload an image preview of each document.

Click ‘Save Pod’.

How to make your documents downloadable

Some WordPress document libraries add the documents as website content, rather than downloadable content. By this I mean you’d enter the content of your document within the main content area for your custom post. People would then view it online without downloading anything. If you use this method for your WordPress document management, you can skip ahead. Or, if you’re planning on including downloadable documents in your library, read on.

Create a custom field to link to the file. To do this, choose the WYSIWYG Visual Editor custom field type. When you start adding documents in a minute, use this field to add a clickable link to the downloadable File URL for each document.

Add the custom field to the document library. I’ll tell you how to do this in step 3.

Tip: If your theme comes with styling for buttons, then you can also add a button to the custom field instead of a basic text link. Or, if you’re feeling creative, then you can even upload an image or icon and make it clickable!

Create direct document downloads with the Page Links To plugin

If you don’t want to bother creating a custom field for your downloadable documents, check out the Page Links To plugin. This free plugin lets people download the file simply by clicking on a title in the document library table.

It works perfectly with Posts Table Pro. It’s ideal if you want people to download directly from the table instead of accessing the single post page. They can simply click on any title in the document library and download the file immediately.

How to create custom taxonomies for your WordPress document library

So far, you have created an area to store items in your WordPress document library. You’ve also created custom fields for storing extra information about each document in the library. In step 3, you’ll be able to display them in your document library using Posts Table Pro. But before we do that, I’ll tell how you to create custom taxonomies for grouping and filtering within the document library.

Navigate to Pods Admin -> Add New and click ‘Create New’.

On the ‘Add New Pod’ screen, choose ‘Custom Taxonomy (like Categories and Tags)’ from the dropdown list.

Add a Singular and Plural Label for the taxonomy. For example, if you’re creating a taxonomy to categorize your document library then the singular could be ‘Document Category’ and the plural could be ‘Document Categories’.

Step 2. Add the documents to the library

Once you’ve created your Documents post type and all the fields you need, it’s time to add content to the document library. This is a similar process to adding standard WordPress posts:

Go to your custom post type and create a new post for each document that you will be adding to the library.

Add the document title as the main title at the top of the page.

Add a short description in the area where you would normally add the post content. I recommend keeping this short if you will be displaying the description in your document library because that will let you display the full text without being truncated.

Tip: If you have lots of documents to upload, then you can add them in bulk using a WordPress import plugin. The built-in WordPress importer doesn’t support extra data such as custom fields and taxonomies, so you’ll need a more advanced solution such as WP All Import.

View your document pages

If you try creating a document and click ‘View Post’, you can see what the single post page for your documents will look like. This is where people will be taken after they click on a link in your document library (depending on how you set it up). It will have a similar layout to your blog posts and won’t include your custom fields, taxonomies, or document download link.

If you don’t want to use this page, then I’ll tell you how to disable the links to it in a minute. Or if you do want to use the single document page, then you may wish to create a custom template for your documents post type. If you don’t know how to code a custom template, we’d recommend Codeable for small tasks like this.

Step 3. Create your WordPress document library

Now it’s time for the fun bit: creating a WordPress document library to display your documents.

To do this, you’ll need the Posts Table Pro plugin. Once you’ve purchased, installed and activated the plugin, you can add your document library to any page of your website. Using a shortcode, the plugin will automatically display all your documents as an interactive table.

Posts Table Pro

Configure your document library

In the knowledge base, there are dozens of options that let you configure your WordPress document library exactly as you like.

Go to the Posts Table Pro plugin settings page at Settings -> Posts Table Pro. Read through the settings and choose the ones that are most suitable for your document library. To get you started, I’ll show you which ones to choose for most types of document library:

Post type – Select the post type that you created in Step 1.

Columns – Choose which columns to include in your document library. Add image,title,content:Download,tax:wpdmcategory,excerpt,date to show columns for featured image, document name, content (this column will be called ‘Download’), category, excerpt, and published date.

Shortcodes – Tick this box if you want to display clickable download links in the document library.

Links – This option controls what happens when someone clicks on the name of a document:

Leave this set to ‘all’ if you want users to be able to click through to a separate page for each document. For example, this is useful if you plan to include the full document content on your website, instead of as a download link.

Add ‘none’ if you want to disable the single document page. If you do this, then users will be able to click on the link to download the document, but won’t be able to visit the single document page.

Alternatively, if you’re using the free Page Links To plugin mentioned above, then this will automatically disable the links to the single document page. When someone clicks on a document in the document library, they will be taken straight to the download link and will never see the single document page.

Create a document library page

Next, create a new page and call it ‘Document Library’ or whatever you like. Add a [posts_table] shortcode to the page. This shortcode will list all your documents in an interactive document library, with all the options you chose on the plugin settings page.

Depending on your settings and theme, here are some examples of what your WordPress document library might look like:

Use the knowledge base to configure the document library to your heart’s content. WordPress document management made simple! You can also jump to the Bonus Tips section of this tutorial for more advice on how to perfect your WP document library. This includes advice on how to add filters above the list of documents, how to create a private document library, how to track document downloads, and more.

Method 2 – Display media library files directly in a document library

To recap, method 2 takes documents from the WordPress media library and displays them directly in a WP document library on the front end of your website. You can add extra information about each document, but – unlike method 1 – there’s no need to create a separate post for each one.

The WordPress media library comes with several built-in fields for storing data about your documents. You can include these as columns in your table-based document library. The build-in fields are:

File name – you can display this with or without a link to download the file.

Image (if you are displaying images files) – you can display these with or without a link to download the file. Other file types (e.g. PDF) will just show the file name in this column.

Caption – a useful way to show a description or summary of each document.

If you want your WordPress document library to display additional information about each document, that’s fine too. I’ll also show you how to add extra custom fields, categories and taxonomies to the media library which you can include in the document library. For example, these are useful for displaying data such as the file type, size, add extra descriptions, or even add extra links, images, download icons or buttons.

Step 1 – List document files from the media library on the front end

First, I’ll tell you the quickest possible way to create a front end document library listing files from the WordPress media library. This will work with any file type, including PDF’s. Afterwards, we’ll customize it in more detail:

Paste in your license key and choose the settings for your WordPress document library. Most importantly, find the Post Type setting and select ‘Attachment’. This is the name of the built-in post type that WordPress uses for files in the Media Library.

Now, create a new page under Pages -> Add New, and add the shortcode: [posts_table]

Alternatively, if your media library contains non-image files (e.g. PDF, XLS or DOCX) then it will look similar to this:

Step 2: Edit your document library columns

So far, the WP document library is using the default columns that come with Posts Table Pro. These are the file title, content (which displays an image for image files, or a filename for other file types), author, and date.

Not all of these are relevant for a document library. As a result, you should change which columns appear in the table. You can easily do this via the ‘Columns’ option on the Posts Table Pro settings page.

For example, adding the following to the Columns option will show columns for title and description. It will also rename the title column to ‘Click To View File’ and will rename the content column to ‘File Description’:

title:Click To View File,content:File Description

When you add the [posts_table] shortcode now, it will look more like this:

How to add download links to the document library

By default, users can click on the file name of a document to access the attachment page. The attachment page includes a link where users can download the document.

This isn’t very user-friendly because no one really uses the attachment page in WordPress, and it requires an extra ‘click’. Instead, I recommend letting people download files directly from the main document library page. If you’re using the Yoast SEO plugin then there’s a setting to disable the attachment page. Yoast have provided a helpful tutorial about how to set this up. (If you’re using a different SEO plugin, then you should check whether it has a similar setting):

This disables the attachment post and lets people click on the document name to download it directly to their computer.

Step 3: Make your document library more flexible

In step 2, you learned how to list your media library files in a document library with the built-in fields. In this section, I’ll tell you how to add more flexibility by installing some free WordPress plugins. This will enable you to:

Categorise and tag your WordPress document library.

Create multiple tables, each listing different documents from the WordPress media library.

Display extra information about each document.

Add filter dropdowns above the document library to help people to find what they need more easily.

Add more eye-catching document download buttons, or even icons that users can click on to download the file.

Sound good? Keep reading and I’ll show you how to do all this.

Categorize your WordPress document library

WordPress doesn’t provide a way to structure the media library into categories or sub-folders. However, you can easily add categories by installing the free Enhanced Media Library plugin.

Install the plugin, then find a ‘Media Categories’ link under the ‘Media’ section in the WP admin:

Go to this page and create as many document categories as you need.

Next, edit each document in the Media Library and tick the appropriate category.

There are several ways you can use your document library categories:

Include a categories column in the document library. To do this, just add tax:media_category to the list of columns on the Posts Table Pro settings page.

Add a categories filter above the list of documents. This lets visitors view documents from a specific category.

Create a table listing documents from a specific category only. To do this, edit the page where you added the [posts_table] shortcode and expand it by adding the category slug: [posts_table term="media_category:cat1"] (replace cat1 with the actual slug of your category).

Nice!

Add extra fields to the WordPress document library

Do you want to add extra information about your documents? You can easily do this by adding extra fields to the media library. Choose from:

Custom fields – these list unique information about each document. For example, if you wish to add an extra summary or description about each document, or show the file size or unique reference number, then you should use custom fields.

Custom taxonomies – these let you tag documents in a way that allows you to sort and filter the document library. For example, if you want visitors to be able to filter by year or file type then you should use a taxonomy.

The free Pods plugin lets you add custom fields and taxonomies to the WordPress media library. You can then use this in your front end document library.

How to add custom fields

Click on the ‘Pods Admin’ link in the WordPress admin, then choose ‘Edit Pods’.

You’ll see a list of all the post types on your site. Choose the ‘Media’ post type.

On the next page, you can manage the custom fields for your WordPress media library. Click ‘Add Field’ and type a label and name for each custom field. In the example below, I created a custom field called ‘File Size’ with the label ‘size’. (Make a note of the label – you’ll need this in a minute.)

Click ‘Save Pod’.

Finally, go to edit each document file in the media library. Your new custom fields will appear lower down the page. Add the extra information to them.

How to add custom taxonomies

Go to Pods Admin → Add New -> Create New:

Choose ‘Taxonomy’ from the ‘Content Type’ dropdown list. Choose a Singular and Plural Label (e.g. Year or File Type), then click Next Step:

On the next page, find the ‘Advanced Options’ tab and scroll down to ‘Associated Post Types’.

Tick ‘Media (attachment)’. This adds the new taxonomy to the WordPress media library.

Lastly, click ‘Save Pod’.

Now when you edit a document in the media library, you’ll the taxonomy on the right. Use this to tag your documents with the extra information.

Display your custom fields and taxonomies

Once you’ve added your custom fields and taxonomies, you can start displaying them in your WordPress document library:

This will create a WP document library like the screenshot below. It has a title column (which I renamed to ‘Name’), a content column (which I named ‘Image’ and shows the image for image files, and the filename for non-image files), excerpt (which is the caption field from the media library), a custom field called ‘size’, and a custom taxonomy called ‘Document Year’.

Add download buttons and links to the media library

In the previous screenshot, you can see a ‘Download’ button. This is a more advanced way to allow people to download a media library file.

It’s trickier to set up than simply letting people click on the file name to download the file. This is because it requires an extra step, as you need to manually add a download button for each file. You can also add it as a plain text link, or even upload an additional image or icon for visitors to click on. The instructions on how to add download buttons, links and icons are in this article of the Posts Table Pro knowledge base.

If you don’t want to do this, then I recommend keeping it simple and just allowing the filename column of the table to link to the file URL. This happens automatically and doesn’t require any manual work.

Bonus tips on perfecting your WordPress document library

By now, you’ve learned how to create a document library using either method 1 (create a custom post type) or method 2 (list media library files directly). Before we finish, I will share some tips on how to make your WordPress document library directly, whichever method you used.

Make it easier for people to find specific documents

Your document library comes with a search box at the top right. If you’re using the standard method of loading the table, then the search box looks at all the columns in the table. If you’re using the lazy load option (which lets you list unlimited files in the table without performance problems) then the search box will look at the title of each file.

Unfortunately it’s not possible to search the full content of the downloadable files or PDF’s that are linked to from the document library. As a result, it’s important to use categories and custom taxonomies to tag your documents and make them easy to find. You can then use these to add filter dropdowns above the list of documents. People can use these to quickly refine the list and find the document they’re looking for.

Use the filters option in Posts Table Pro to add these filters. For example, the WordPress document library in this screenshot has filters for Media Categories (created by the Enhanced Media Library plugin) and Document Years (a custom taxonomy created using Pods):

Option A – Password protected document library

It works by password protecting one or more categories within your WordPress document library. Users must enter a correct password to unlock the category and view the private documents inside it. Once they’ve unlocked a category, they can navigate within it and won’t need to re-enter the password for several days.

The benefit of this method is that you don’t have to create a separate user account for everyone who accesses your document library. For example, if you’re creating a document database for employees, then there’s no need for each person to have their own user account on your WordPress site. Instead, just give them a password to unlock the protected library without needing an individual login.

How to password protect your document library

First, create the document library by following the instructions earlier in this tutorial. However, instead of adding your Posts Table Pro shortcode to a normal page in WordPress, you need to add it to your category archive template. This will automatically list documents in the table-based layout whenever someone visits your document category pages.

Go to Documents → Categories. (If you can’t see this, then go back to the settings for your ‘Documents’ custom post type and make sure you have activated categories/taxonomies.)

Create 1 or more password protected categories for the WordPress document library. Some tips:

If you want to create a completely private document library, create 1 password protected category and put all your documents within it. If you want to add sub-categories, that’s fine. Leave them set to ‘Public’ and they’ll automatically be protected with the same password as the main document library category.

If you just want to protect parts of your document library, that’s fine too. Structure it into as many categories and sub-categories as you like. Some of these can be set to public and others password protected.

Now go to the main Documents list in the WordPress admin and categorize your documents as needed. Documents in password protected categories will automatically be protected with the same password as its category.

Finally, create a login page for your users by adding the shortcode [category_login] to any page on your site. They can enter the password here, and it will direct them to the private document library category.

If you’d rather create a separate user account for each person who accesses your document library, then install the Advanced Access Manager plugin. Use it to restrict your WP document library to specific user roles, or even individual logged in users.

Use this method if you want the most secure option and are prepared to create a separate user account for each person who accesses the document library.

First, follow the above instructions to create a WordPress document library with Posts Table Pro. Once you’re done, this is how to make it private:

Use a front end login plugin such as Theme My Login to create a user-friendly login page.

Whenever someone logs into their account, they will be able to access the private WordPress document library.

Tips

For more granular control, you can create multiple user roles and show different documents to different users. Your main document library page will automatically show the correct documents for each logged in user.

If you don’t want to bother creating a unique user account for each person, that’s fine. Instead, you could create one user account and let people share a username and password. Obviously, this is less secure than having individual document library accounts.

Are you showing different documents to different people? If so, DO NOT tick the ‘Caching’ option on the Posts Table Pro plugin settings page. This will ensure that each user sees the correct documents, and not a cached version of the library.

How to sell documents

So far, I’ve assumed that you want to provide free access to your WordPress document library. But what if you want to sell printed or digital documents online? Fortunately, you can do that too.

The easiest way to create an e-commerce document library is to use our other plugin WooCommerce Product Table, instead of Posts Table Pro. The instructions for selling documents in this way are similar to the document library tutorial in the previous sections. The main differences are:

Add each document as a WooCommerce product. This is instead of having a ‘Documents’ post type for storing documents or displaying files from the media library. In WooCommerce, choose the ‘Downloadable’ product type and upload the file that people will receive after purchasing the document. You can also add other information such as the price.

WooCommerce Product Table has a different shortcode for listing your document products. You can read about all the options in this article.

Your WordPress document library will look similar to the other screenshots in this article. The difference is that they will actually be e-commerce products available for sale, with add to cart buttons.

How to track document downloads

WordPress doesn’t have any built-in analytics to track the number of downloads from your document library. Instead, you can do this using analytics software, such as event tracking in Google Analytics.

How to update a document without changing the URL

Sometimes, you’ll want to update a document in the library. This is an important part of your regular document management. Obviously, you want to make this process as simple as possible. How to do this depends on how you’ve added your documents:

Documents added directly to the content of a post (or custom post type). Edit the document post, replace the content with the new document, and click Update. The document will automatically update in your Posts Table Pro document library.

Downloadable documents in the WordPress media library. Alternatively, use the free Enable Media Replace plugin to replace documents in the media library without changing the URL. That way, you simply replace the file and don’t need to update any document library links.

Can users submit documents to the resource library?

A lot of websites list documents that users have submitted themselves. You can do this by using the Posts Table Pro WordPress document library plugin with Gravity Forms. We’ve published a separate tutorial on how to do this.

See a document library in action – RJ Lee Group publications library

RJ Lee Group are an industrial forensics analytical laboratory and scientific consulting firm. Their staff make regular presentations and public in peer-reviewed journals, so they wanted a publications library on their website showcasing the firm’s work.

With over 300 publications, they needed a user-friendly and easy-to-search library.

They used Posts Table Pro to create a publications library listing their articles. The table displays 25 publications per page with pagination allowing users to view older documents. It includes columns for publication title, citation and date.

You can sort the document library by clicking on any column. The search box above the table lets you further navigate the publications in the list.

Posts Table Pro

Lastly, you can buy Posts Table Pro here. And if you like it, register as a Barn2 Media affiliate and get 30% discount for recommending our WordPress plugins! I hope you enjoy creating your WordPress document library!

1. You can use the tags that come with WordPress itself, and which will appear in a 'Tags' section on the right hand side of the Add/Edit Document screen. The only problem with this approach is that the same tags will be used for other content types such as blog posts, which you may not want.

2. If you want a dedicated way to tag documents, then you can create a custom taxonomy and call it 'Document Tags' or similar. There are instructions for this in the above tutorial.

Either way, you can add a tags (or taxonomy) filter dropdown above the document library by following the instructions on this page.