1. Document Library Pro
  2. Document Library Options

Links in the document library

Document Library Pro lets you add various types of link, both to the actual document (whether this is a downloadable file or a link to a specific web page), and to a separate page for each document. This article explains how to set up and control these links

Use this option to choose whether the link field contains a link to the document. If you disable this then you can still enable the document preview

The styling and behavior of the document link is controlled by other options - the 'Link style' option controls whether to display it as a button/icon/text link, and the 'Link destination' option controls whether it links directly to the document or to the single document page.

This option is enabled by default. You can either configure it globally on the plugin settings page, or directly in the shortcode as follows:

  • [doc_library document_link="true"]
  • [doc_library document_link="false"]

Use this option to choose what style of link to include in the document library. The selected link style is used on the list of documents and also on the individual page for each document. 

You can either configure the link style globally on the plugin settings page, or directly in the shortcode as follows:

  • [doc_library link_style="button"]
  • [doc_library link_style="button_icon_text"]
  • [doc_library link_style="button_icon"]
  • [doc_library link_style="icon_only"]
  • [doc_library link_style="file_type_icon"]
  • [doc_library link_style="text"]

Note: icon will display a download icon, whereas file_type_icon will display a file type icon. 

Use this option to control the text that appears in the link field when 'button' or 'link' is selected. It is case sensitive, so you can choose whether to enter the link text in UPPERCASE, lowercase etc. as required. You can either configure the link text globally on the plugin settings page, or directly in the shortcode as follows: [doc_library link_text="View Document"] The link text is used on the list of documents and also on the individual page for each document. 

When someone clicks on a link in the link field, you can choose whether they will be immediately taken to the downloadable file or URL you have entered for the document; or whether they will be taken to a separate page for the document. The separate page will contain all the information about the document, plus a link to access the download/URL if you have added one. You can either configure the link style globally on the plugin settings page, or directly in the shortcode as follows:

  • [doc_library link_destination="direct"]
  • [doc_library link_destination="post"]

Note: This option only controls the link field. If you wish to prevent people from accessing the single document page at all, then we recommend setting the link destination option to 'Direct access' and setting the clickable fields option (above) to 'none'. This completely disables access to the single document page, so that users will only be able to access the document directly from the link field.

Choose whether to open links to documents in a new browser tab. The default is to open in the same tab (self) and you can also open them in a new tab (blank). You can either configure the link style globally on the plugin settings page, or directly in the shortcode as follows:

  • [doc_library link_target="blank"]
  • [doc_library link_target="self"]

Note: This option only affects the link field. We haven't provided an option to open the links to the single document page in a new tab because these are internal links and it is not good practice to open these in a new tab. However, our developer documentation contains a filter that you can use to do this.

Clickable fields

The clickable fields option lets you control which fields in the document library - if any - link to the single document page. This option does not affect the link field, which is always clickable. The following fields can be formatted as links:

  • idtitle, and image - these fields can link to the single document page.
  • doc_categoriesdoc_tagsauthor, document_author, and any custom taxonomy - clicking on these will either filter the document library to show items with that term; or you can disable search_on_click to link to the category/tag/author/taxonomy archive page instead.

Choosing which fields are clickable

You can either configure the clickable fields globally on the plugin settings page, or by setting the links option directly in the shortcode for each individual document library. You can use the following values:

  • Use all to make all possible fields clickable (this is the default).
  • Use none or false to disable all links to the single post page.
  • You can also use any combination of the following keywords, as a comma-separated list:
    • id - The ID field will be clickable (links to document)
    • image - The image field (links to document)
    • title - The title field (links to document)
    • author - The author field (links to author archive page)
    • doc_categories - The categories field (links to category archive page)
    • doc_tags - The tags field (links to tag archive page)
    • terms - Any custom taxonomy column (links to taxonomy archive page. Note: you cannot use the taxonomy column name in the links option - instead, just add terms to make all taxonomy columns clickable)

For example, if you enter title,doc_categories for the clickable fields option on the settings page, then only the title and categories columns will be clickable. Example shortcodes:

  • [doc_library clickable_fields="title,doc_categories"]
  • [doc_library clickable_fields="none"]

Note: Links within the content, excerpt or custom field columns are not controlled by the clickable fields option. Please see below for more information.

Document Library Pro is only designed to allow people to access the document directly from the link field, or from the single document page. If you would like the links on other fields to take users directly to the document - bypassing the single document page - then you can do this by installing the free Page Links To WordPress plugin.

This plugin lets you add a URL to any page, post or custom post (e.g. to a PDF in your Media Library or a page on an external website). When someone clicks on a link to view the page/post/custom post, they will be taken to this URL instead.

Accessing documents

Choose from the following options to control how users will access the document: 

  • Link to document - Display a button/icon/text link (depending on the 'Link style', below) linking to the document. 
  • Multi-select checkboxes - Display a checkbox next to each document so that users can download multiple items at once. 
  • Both - Display a link to the document and a checkbox. 

You can either configure this option globally on the plugin settings page, or directly in the shortcode as follows:

  • [doc_library accessing_documents="link"]
  • [doc_library accessing_documents="checkbox"]
  • [doc_library accessing_documents="both"]

Note: The checkbox option only supports certain file types. For other types of document, the checkbox will not appear. If any of your documents are unsupported file types then we recommend changing the format (e.g. from Word to PDF) or enabling a link to each individual document so that they can still be accessed.

Multi-download button

If you have set the 'Accessing documents' option to 'Multi-select checkboxes' or 'Both', then a checkbox will appear next to each document. A 'Download Selected Documents' button will appear so that users can download all the selected items as a zip file.

You can set the button to appear above the table, below it, or both. Either configure this globally on the plugin settings page, or directly in the shortcode as follows:

  • [doc_library multi_download_button="above"]
  • [doc_library multi_download_button="below"]
  • [doc_library multi_download_button="both"]

Multi-download button text

You can also change the text that appears in the 'Download Selected Documents' button. 

Configure this globally on the plugin settings page.

You can manually add links to any text-based fields which you are displaying in your document library tables. This might include the document content, excerpt, or a text custom field. Since these links are added manually, they are not controlled by the above link options.

Please note that links and other HTML in the main content are normally removed by Document Library Pro. This is because the content is truncated using the content_length option. If the HTML wasn't removed, the content could be split incorrectly and missing the necessary closing HTML tags such as </a>, </p>, </div> etc. To preserve the HTML formatting, including links, you would need to set the content to display in full. You do this by setting content_length=-1 in your shortcode, or in the plugin settings. The same applies to the excerpt column. If you wish to display links within the excerpt, you will need to set the excerpt_length=-1.

Search on click

Table layout only

By default, clicking on a document category, tag or custom taxonomy term in the table will search (i.e. filter) the table by that value. If you are NOT using the lazy load option, then you can also filter the table by clicking on an author. This is a quick way of filtering the table if you have lots of posts. You can disable this search_on_click feature so that when someone clicks on a category, tag, author or custom taxonomy term, then they will be taken to the relevant category/tag/author/taxonomy archive instead. Example:

[posts_table columns="title,doc_categories,doc_tags" search_on_click="false"]

Tip: This option will only work correctly if your theme includes archive pages for categories/tags/custom taxonomy terms.

Related Articles

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