1. Home
  2. Knowledge Base
  3. Document Library Pro
  4. Document Library Options

Document library content

Document Library Pro comes with 2 layout options - table and grid - which are controlled by the layout option. You have full control over the data displayed in the document library.

Available fields

This option controls the information which is displayed about each document. The available options are:

  • Table layout - idtitlecontentexcerptimagedatedate_modified, doc_author, doc_categoriesdoc_tags, download_count, file_sizefile_type, filename, statuslink, or any custom field or taxonomy.
  • Grid layout - title, image, doc_author, doc_categoriesdownload_countfile_sizefile_type, filename, link, or any custom field.
Document library columns
A table containing fields for image, ID, title, date, modified date, tags and link

 

 

 

 

 

Choosing your fields

There are 2 ways to choose which fields to display in your document libraries:

  • In the Display settings at Documents → Settings → Display.
  • Using the content option in the [doc_library] shortcode (e.g. [doc_library content="title,content,link"].

Table layout

Use the column builder to add and re-order your table columns as needed. Click the pencil icon for a column to access the following settings:

  • Rename the column header label.
  • Choose whether or not the column is clickable (available for clickable column types only).
  • Choose where the column links to (e.g. the single document page or the download file).
  • Advanced settings:
    • Hide the column heading.
    • Column type - This only appears for custom field and taxonomy column and lets you set columns as either Text, Date or Number. This affects the column sorting.
    • Set the column width.
    • Set the responsive visibility (i.e. which devices the column is visible on).
    • Set the responsive priority (i.e. in which order the columns are hidden when there are too many to fit on the page).

Grid layout

Use the checkboxes to choose which fields to include in the document grid. You can further configure these fields using the options below:

  • Clickable fields - Choose which fields are clickable (in addition to the 'Document link' field which is always clickable).
  • Number of columns - Select from 1-4 columns to adjust the grid layout.
  • Document title and File name - Choose whether clicking on these fields will download the file or link to the single document page.

Details of fields

Fields available for both table and grid layouts

  • The title field is the main document title.
  • The image field will display the featured image (i.e. the document thumbnail) for the document or page (see image_size option to set a custom size for the table layout). If you are using the grid layout then the image field will display the featured image if available, otherwise it will show a file type icon.
  • The doc_author field will display the name of the document author. (Note: This is different from the WordPress user who created the document. We have separate instructions on how to display that.)
  • The doc_categories will display the categories for each document (comma-separated if there is more than one).
  • The link field will contain a link to the document and/or a preview link.
  • The filename field will display the file name as plain text, with no link. This is just for information and you should use one of the clickable fields for document links.

Fields available for table layout only

  • The id field will display the document ID, which is a unique number used internally by WordPress for each document.
  • The content field will show the document content but will be truncated to 15 words. You can modify this by setting the content_length option. For the grid layout, if there is no content then the excerpt will be displayed instead.
  • The date field will display the date that the document was published.
  • The date_modified field will display the date that the document was last updated.
  • The doc_tags field will display the tags for each document (comma-separated if there is more than one).
  • The status field will show the status of the document (e.g. draft, pending, publish, etc).
  • The download_count will show the total number of downloads for individual documents.

Custom field columns

Custom fields are a good way to include other types of content in the document library. You can use them to store links, buttons, icons, shortcodes from other plugins, etc. You should add the full HTML code or shortcode to the custom field so that the document library can display it correctly. If you’re adding shortcodes to your custom fields, you will need to set shortcodes to true.

The easiest way to include custom fields is via the Display tab in the plugin settings. To add them via a shortcode, you must use the format cf:<field name>. (E.g. If you are using Advanced Custom Fields, the field name can be found under the “Field Name” column in the Custom Fields menu.)

Here’s an example of adding two custom fields – my_field1 and my_field2:

[doc_library content"title,content,cf:my_field1,cf:my_field2"]

Tip: While you can use any custom fields plugin to create custom fields, we recommend Easy Post Types and Fields plugin. Alternatively, you can create custom fields with Advanced Custom Fields, Custom Posts Type UI, or Pods.

Custom fields created using the Toolset plugin

If you're using Toolset to create your custom fields, then you need slightly different syntax to display them in the document library.

Toolset adds wpcf- to the start of the custom field name, so if you create a custom field called 'link' (for example) then the correct syntax will be wpcf-link. This means that if you want to create a document library with columns for name and a custom field called 'link' then you would need to add it as follows:
[doc_library columns="name,cf:wpcf-link"]

ACF repeater fields

If you're using Advanced Custom Fields Pro repeater fields, you can create a column using the name of the parent repeater field. This column will list the content of all the repeater fields for that document, separated by commas. It is not possible to display repeater sub-fields as separate columns in the document library.

ACF group fields

Please see our separate article on how to display sub-fields which are part of an ACF group field.

Custom taxonomy table columns

For taxonomies (other than document categories and tags), use the format tax:<taxonomy slug>. So, for example, to display a custom taxonomy with the slug document_type, you would use:

[doc_library columns="title,content,tax:document_type"]

You can find the taxonomy slug by going to the WordPress admin and finding the main page which lists those taxonomies. For example, WooCommerce product categories are edited under the Products → Categories menu. On that page, the URL at the top of the screen shows “…edit-tags.php?taxonomy=product_cat….”. The ‘product_cat’ bit after the equals is the taxonomy slug you need to use.

Creating custom columns programmatically

Developers can use custom table columns to display data programmatically which is not available as one of the standard document library columns.

Choosing your own column headings

To change the table column headings in table view, simply click the pencil icon for a column in the Display tab and reword it as needed.

You can also do this in the shortcode by using the columns shortcode option to list the columns and adding a : (colon) after the column name, followed by the custom wording. You can use this method to change the wording and/or capitalization of column names. For example, this shortcode will change the title field to "MY HEADING" and the author field to "AUTHOR":

[doc_library columns="title:MY HEADING,date,doc_author:AUTHOR,content"]

Custom column headings

Custom column headings for Title, Image, Date, Categories & Tags

Here’s a more complex example where we want to set the title column heading to “Property Description”, the date column to “Added On”, a custom taxonomy to “Type” and a custom field to “Sale Price (£)”:

[doc_library columns="title:Property Description,date:Added On,tax:listing_cat:Type,cf:valuation:Sale Price (£)"]

Note: In the above example, the taxonomy and custom field columns now have two colons – one to define the taxonomy (or custom field) name, and the other to set the column heading. This is fine as long as you use the correct syntax. For these column types, everything after the second colon will be used as the custom heading, including the space between the 2 words.

Removing a column heading

To remove a column heading for table view, open the Advanced settings for a column in the column editor on the Display tab and disable the 'Show column heading' toggle.

You can also do it in the shortcode by using the keyword blank after the colon. For example: [doc_library columns="title:blank,content,categories"]

When you do this, the field names will be removed and only the sort arrows will be hidden. If you want to hide the header row completely then you can do this using custom CSS.

How to hide a field

You can easily hide fields simply by removing them from the column builder for the table layout, or unticking the relevant box for the grid layout on the Display tab.

If you wish to hide a field on specific devices only (e.g. mobiles or tablets), use the responsive visibility option.

Related Articles

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