How to Create a WordPress Document Library

A WordPress document library is presents your documents in an easy-to-find format. You can use a document library as a file manager to keep things organised, share resources within your organisation, create a knowledge hub or a publications database. Your document library might be public, or private and available to specific people only.

It’s surprisingly hard to find a good document library WordPress plugin. There are lots of document management and file manager plugins for the WordPress admin, but very few to create a front end document library for users. The ones that do exist have poor ratings and a lot of negative feedback. Read on to discover why Posts Table Pro is perfect for your WordPress document library…

WordPress document library plugin

Posts Table Pro – the perfect WordPress document library plugin

The Posts Table Pro WordPress plugin instantly creates interactive WordPress tables. You can use it to display documents, PDF’s, publications or any other types 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.

In this tutorial, I’ll explain how to use Posts Table Pro as a document library WordPress plugin. This is a fantastic way to create a document library in WordPress. Later, I’ll also share some tips on how to make your document library (or just parts of it) private and hidden from public view.


Before we start, I’ll show you an example of Posts Table Pro in use for a WordPress publications library.

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

WordPress publications library database plugin

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 to list in the library, they needed a user-friendly table that makes it easy to find a specific publication.

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.

Each column can be sorted and a search box above the table lets you further navigate the publications in the list.

1. Decide how to store your documents in the library

Now I’ll tell you how to create a WordPress document library for your own publications.

Posts Table Pro does NOT store your documents for you – you can use WordPress for that. Posts Table Pro’s job is to create a library of documents added to your WordPress website. If your documents are already stored on your website, that’s great and you can skip to step 3. Or if you’re still planning your WordPress document library, I’ll tell you how to add documents now.

Posts, custom posts or pages?

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

  • Add each document as a post in the ‘Posts’ 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.
  • Add each document as a standard Page in the ‘Pages’ section of the WordPress admin.

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, that’s fine – in step 3, you just need to remove post_type=”documents” from the Post Table Pro shortcode examples in this article. To use pages, just add post_type=”page” to the shortcode instead.)

How to create a WordPress custom post type

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

  1. Go to Plugins > Add New and install a custom post types WordPress plugin such as Custom Post Types UI. It doesn’t matter how you create your custom post type, but this is the plugin I recommend which is easy to use. If you’re a WordPress developer, you can create your custom post type without using a plugin.
  2. Activate the plugin and then click on the ‘CPT UI’ link in the left of the WordPress admin (near the bottom).
  3. Next create your custom post type:
    • Post Type Slug – this will be used at the end of the URL for each of your documents. e.g. if you type ‘documents’ here then the URL for your documents will be in this format: http://[]/documents/[document-slug]. Use lower case.
    • Plural Label – type the plural version of your custom post type name here. For example if you type ‘Documents’ then the link on the left hand side of the WordPress admin will say ‘Documents’. Use title case.
    • Singular Label – add the singular version of your custom post type name, e.g. ‘Document’. Use title case.
    • Click ‘Add post type‘. The page will refresh and you will see a new section in the left of the WordPress admin called ‘Documents’ (or whatever you added as the Plural Label). That’s where you’ll store everything in your document library.

WordPress document library

View your custom post type

If you try creating a document and clicking ‘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 up Posts Table Pro – see below).

If you’re not happy with the layout then you may need to create a custom template for your documents post type. If you don’t know how to code then we’d recommend Codeable for small tasks like this.

How to store extra data about your documents

Now we’ve created a custom post type for your WordPress document library. Next I’ll tell you how to store extra information about each item in your document library.

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

Custom fields, taxonomies or something else?

Here are some tips to 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 then 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 organise 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.

Next, I’ll show you how to create custom fields and taxonomies for your Documents post type.

How to create custom fields for your WordPress document library

If you’re a developer then you will already know how to create custom fields, so ignore this bit. If not, this is how to do it:

  1. Go to Plugins > Add New and install the Advanced Custom Fields WordPress plugin.
  2. Activate the plugin and then click on the ‘Custom Fields’ link in the left of the WordPress admin.
  3. On the ‘Field Groups’ page, click ‘Add New’ and enter a name for your field group. This won’t be shown on the website and is the plugin’s way of storing the custom fields relating to your WordPress document library so call it ‘Documents’ or similar. Next click ‘Add Field’ and add all the information, including:
    • Field Label – Add a custom field label custom field, e.g. ‘File Type’. This will appear in the WordPress admin.
    • Field Name – Add a custom field slug, e.g. ‘file_type’. This must be one word and can contain underscores and dashes. The Advanced Custom Fields plugin will use this to store the data.
    • Field Type – Choose a custom field type. This depends on what sort of data you will be storing in the custom field. For example it might be standard text, a date, a downloadable file etc.
    • Default Value – Add a default value to save time if your custom fields will re-use the same information. For example if most of the items in your WordPress document library are PDF’s then you could enter ‘PDF’ as the default value. You can override this for specific documents as needed.
    • Formatting – You can choose to display your custom field exactly as you have entered it (in plain text). Or you can choose to render any HTML you have added to the custom field.
  4. Next, either click ‘Add Field’ to create additional custom fields if you need more than one.
  5. When you have created all your custom fields, scroll down to the ‘Location’ section. Select the custom post type you’re using for the WordPress document library, e.g. ‘documents’. This tells Advanced Custom Fields to make the fields available to the custom post type you created earlier.
  6. Scroll up and click the blue ‘Publish’ button.

Create custom field for WordPress document library

Now when you add a new document, you will be able to enter information into these custom fields. In step 3, you’ll be able to display them in your document library using Posts Table Pro.

How to create WordPress custom taxonomies for your document library

  1. How to create WooCommerce custom taxonomyInstall the free Custom Post Type UI plugin.
  2. Go to Custom Post Type UI > Add Edit Taxonomies section in the WordPress admin.
  3. Click the option to add a new taxonomy, and add a Slug, Plural and Singular Label for your taxonomy.
  4. In the ‘Attach to Post Type’ section, make sure you tick the box relating to your Documents post type. So if it’s called ‘Documents’ then tick the ‘Documents’ box in the list.
  5. When you go to add or edit a document, you will be able to add data to this custom taxonomy.

Downloadable documents

Some WordPress document libraries add the documents as actual website content. By this, I mean that you would enter the content of your document within the main content area for your custom post so that people can view it online without downloading anything. If that applies to you then you can skip to step 2.

Other document libraries contain downloadable documents such as PDF’s, Word docs or PowerPoint presentations. There are 2 main ways to do this (but check out the bonus tip in a minute!):

  1. Upload the document to the media library (Media > Add New) and copy the File URL. Then add a link (or button, if your theme includes styling for buttons) to the File URL into the main content area for your post or custom post.
  2. Create a custom field to link to the file. This is the only way to let people download files directly from the main document library without having to view the individual post.

To make the file downloadable from the main document library, you need to enter the relevant HTML code into the custom field – simply adding the File URL won’t work as the link will not be clickable.

For example, I would enter this in my custom field (replace the link in italics with your own File URL):

<a href=”“>Click to download</a>

Bonus plugin! Use the Page Links To plugin for easier downloading

If you can’t be bothered to create 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.

2. Add the documents to the library

Once you’ve planned how you will store your documents and their data, it’s time to add them to the document library. This is a similar process to adding standard WordPress posts:

  1. Go to your custom post type and create a new post for each document that you will be adding to the library.
  2. Add the document title as the main title at the top of the page.
  3. 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.
  4. Add any custom fields, taxonomies etc. to store the data about your document.

3. Create your WordPress document library

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

To do this, you’ll need to install the Posts Table Pro plugin which you can buy here. Once you have purchased, installed and activated the plugin, you can add the Posts Table Pro shortcode to any page of your website to create your document library. The plugin will automatically display all your documents as an interactive table.

As you can see in the knowledge base, there are dozens of options that let you configure your WordPress document library exactly as you like. To get you started, I’ll give you 2 examples of popular ways to use it for a document library.

This shortcode is suitable if you’ve added the content of your documents directly to your custom post:

[posts_table post_type="documents" columns="title,content,tax:doc_year,cf:file_type" sort_by="tax:doc_year" sort_order="desc"]

It will display the data shown in the below screenshot.


The shortcode has been configured with the following details:

  • Display custom posts in the ‘documents’ custom post type
  • Display columns for Title, Content (i.e. the beginning of the description field), Year (taxonomy) and file type (custom field)
  • Sort the table by year in descending order

Your visitors can click on the title of each document to view the single post page.

This shortcode lets you add direct links to downloadable files to your document library. It will display the data shown in the below screenshot.

[posts_table columns="title,content,tax:doc_year,cf:file_type,cf:download" links="none" post_type="documents" sort_by="title"]


The shortcode has been configured with the following details:

  • Display custom posts in the ‘documents’ custom post type
  • Display columns for Title, Content (i.e. the beginning of the description field), Year (taxonomy), file type (custom field) and Download (custom field – this is where I added the HTML code to display the content of my custom field as a link – see above).
  • Sort the table by year in descending order

Again, copy the above shortcode to get started. You can then use the knowledge base to configure the document library to your heart’s content.

Create a private WordPress document library

Finally, I’ll tell you how to create a private and hidden document library in WordPress. You can hide your entire document library – or just specific parts of it – with the Password Protected Categories WordPress plugin.

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 had unlocked a category, they can navigate within it and won’t need to re-enter the password for several days.

How to build a private WordPress document library

  1. 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.
  2. Next, get the Password Protected Categories plugin. Install it using the instructions in the Getting Started email.
  3. 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.)
  4. 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.
  5. 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.
  6. Lastly, 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.


It’s time to set up the WordPress document library plugin

By the end of this tutorial, you should know how to use the table plugin to create a WordPress document library.

As you can see, Posts Table Pro is ideal as a WordPress document library plugin. Once you’ve finished, there are lots of other ways you can use it. To get even more value for money, you can create tables of other types of content too. For example:

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!