1. Document Library Pro
  2. Getting Started

3. Adding and importing documents

The Document Library Pro plugin provides 3 ways to add documents:

  1. Add documents manually
  2. Upload files direct to Media Library
  3. Bulk import documents

Add documents manuallyAdd Document to Library

The process for adding a document is similar to creating a page or post in WordPress:

  1. Go to Document Library → Add New.
  2. Complete all the fields of information that you wish to display about your documents:
    • Title (required) - The title of the document.
    • Content (optional) - Use this field for a description of the document, or to add the full content of the document if you want it to be available online without having to download it. Supports all standard WordPress formatting options, shortcodes and embedded audio/video players.
    • Excerpt (optional) - Add a brief summary of the document.
    • Author - The username of the user who created the document. You can change this to any other user instead.
    • Document Link (optional) - Upload a file or add a URL where the document is located. Choose from 3 link options:
      • None - Use this if you have added the full document to the content field, and do not wish to link to a downloadable file or another URL.
      • File Upload - Use the ‘Add Media’ button to upload a file. This will be attached to the document as a downloadable file.
      • Custom URL - If you wish to link to a separate web page on your website or any third party site, then enter the full URL here. For example: https://google.com
    • Document Categories (optional) - Create categories for your documents. Note: These are separate from post categories and will only be used for your documents.
    • Document Tags (optional) - Use tags to make your documents easier to find. Note: These are separate from post categories and will only be used for your documents.
    • File size - If you have uploaded a document directly then this will be greyed out and calculated automatically. If you are linking to a third party URL from the 'Document Link' field then you can enter the file size manually, for example if you are linking to a file that is hosted on Dropbox. Enter the file size in any format you like, e.g 2.5MB.
    • Featured image (optional) - Upload an image if you wish to include an image column in the document library.
    • If you have added custom fields or taxonomies to the documents post type then these will appear too. (Learn how here.)

Whichever fields you complete will appear on the single document page. You can also include any or all of these fields as columns on the main document library page.

If any of the above fields are missing and you wish to use them, then please make sure they are enabled on the settings page.

Direct file upload

You can use drag and drop to upload one or more files directly to the WordPress Media Library:

  1. Go to Documents → Import.
  2. Go to the 'Drag and drop file upload' section.
  3. Drag and drop one or more files within the dotted lines, and wait for them to upload.

Drag and Drop Document Library

Note: You can only upload file types that are supported by your WordPress installation.

Once uploaded, the following will happen for each file:

  • A document post will be created, which you can find on the main Document Library page in the WordPress admin. The filename will be used to create the document title, so we recommend giving each file a suitable name before uploading it. You can then edit each document to add extra information, as required.
  • The file will be tagged as a 'Document' within the Media Library so that you can use the 'Type' dropdown to view document files only.
Edit Uploaded Documents

The uploaded files appear as document posts in the main list of Documents

Bulk import documents

If you wish to bulk import documents with additional information about each one, then you can import them from a CSV file:

a. Add your document fields

First, you need to make sure that your document library is set up with all the fields that you will be importing. You can do this by enabling the relevant fields on the settings page and by creating any additional custom fields that you require.

b. Prepare the CSV file

Next, you should create a CSV file containing all the data about each document. You can do this using any spreadsheet software such as Microsoft Excel, iOS Pages, or Google Sheets - create the file and use the 'Save As' option to select the .csv file type.

Each document library field should be stored as a column in the CSV file. Add each document as a separate row in the CSV file, and include a header row.

Sample Document Import CSV

It is essential that the format of your CSV file is correct. Some tips:

  • Download our sample CSV file (right-click and save it to your computer) and open it in a spreadsheet program such as Excel. The sample CSV assumes that you are using all the default fields, plus 2 custom fields. You should edit the columns to delete any you don't need, and add any additional custom fields. Also delete the sample documents from our CSV file (rows 2-4) - these are simply intended to show you how to format the data for each field type. It's fine to import the same documents if you like, but remember to delete them before launching your finished document library! All fields apart from 'title' are optional:
    • Name - This is the name of the document and will appear in the 'title' column of the document library and at the top of the single document page.
    • Categories - The names of your document categories (not the slugs). If the categories already exist on your website then the documents will be added to the existing categories, otherwise new categories will be created. Use > to indicate parent/child category structures, as shown in row 2 of the sample CSV. (Note: When you specify parent/child categories, the document will be added to the child category but not the parent.)

      Due to how CSV files work, it is not possible to add a comma to separate categories within a cell - however, you can get around this by using , instead of a true comma.

    • Tags - Enter the names of your document tags (not the slugs). If the categories already exist on your website then the documents will be added to the existing tags, otherwise new categories will be created.
    • File URL - If you want to upload the document file directly to your Media Library then enter its URL here. The URL must link to the file itself and not a webpage, e.g. https://www.website.com/my-file.pdf. (Tip: If you’re using Dropbox, ensure the URL ends with ?dl=1 so the file uploads correctly. For example: https://www.dropbox.com/s/hriinb9w3a2107m/myfile.pdf?dl=1)
    • Direct URL - Enter a URL here (e.g. https://google.com) if you want to link to a document in a third party location, instead of uploading it directly to your Media Library - for example, if the document is a YouTube video then you would add the YouTube link here.
    • Featured Image URL - If you want to include an image of each document (either in the 'image' column of the document library or on the single document page) then add the URL of its current location here. It will then be uploaded to the Media Library and set as the featured image for the document.
    • File Size - You only need to import the file sizes if you are linking to externally hosted documents, e.g. on Dropbox. If you are uploading documents directly to the Media Library then the file size will be calculated automatically.
    • Excerpt - Enter text or HTML if you wish to include a document excerpt.
    • Content - Enter text or HTML if you wish to include more in-depth content for the document. This might be a longer description or the full content of the document.
    • Published - Enter 'TRUE' to publish the document as soon as it is uploaded; or 'FALSE' if you wish to save it as a draft so that you can make any changes before publishing it manually.
    • cf: If you have created custom fields for your documents then you should add each one as a separate column, as in the sample CSV. Add cf: before the custom field name in the header row.
  • Create a test CSV file containing 1 document and upload this first, as a test. You can then repeat the test until you are happy with the results, before doing the full upload.

Notes:

  • It doesn't matter whether the column headers in the CSV file are the same as the field names in your document library, as you will match them up as part of the import.
  • It is not possible to import into custom taxonomies, so you should use categories, tags or custom fields instead, or create the custom taxonomy and tag each document manually after the import. We are tracking the demand from people wanting to import custom taxonomies - please send us a feature request if you would like this.

c. Upload the CSV file

  1. Go to Document Library → Import.
  2. Go to the 'CSV upload' section and click 'Import CSV'.
  3. On the 'Import documents from a CSV file' page, use the 'Choose file' button to select the CSV file and click 'Continue'.
    WordPress Document library CSV import
  4. On the 'Map CSV fields to documents' page, match each of the columns from the CSV file to the fields that are used for the document custom post type. This ensures that the data is imported to the correct document library fields. Document Library Pro will try to do this automatically based on the header row of your CSV file, and you can manually change the selections as needed.
    Map Imported Document Library Fields
  5. Click 'Run the importer'.
  6. This will import the documents and attached files to your WordPress site. You will then see a success message with a link to edit the documents.

What about files already in the Media Library?

If your document files (e.g. PDF's) are already in the WordPress Media Library then you need to convert them into documents in order to display them in the document library. You can do this as follows:

  1. Go to Media in the WordPress admin.
  2. Use the icon above the list of media files to make sure you are viewing the Media Library as a list rather than a grid.
  3. Select the files that you wish to display in the document library.
  4. Open the 'Bulk actions' dropdown above the list of files, and select 'Add to document library'.
  5. You will see a success message with a link to edit the newly created document post, which will appear in your document library. You can use this page to add further information about each document via the Documents section of the WordPress admin. If you don't add further information then the filename will appear in the total column of the document library, and users will be able to click to download the file.

Convert WordPress Media Library File to Document Library

Updating and replacing documents

Please see our separate article for advice about updating your documents in future.

Display your documents

Now you've added some documents, it's time to start displaying them on your website.

Displaying Documents

Related Articles

Still need help?
If searching the knowledge base hasn't answered your question, please contact support.