1. Home
  2. Knowledge Base
  3. Document Library Pro
  4. 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. 

The same options are available for links in the table and grid layout, although the method for adding them via the Display settings page is slightly different. For table layout, you can control the links by clicking on the pencil icon for a column in the column editor. For grid layout, the options appear under the list of available fields.

You can add a main 'Document link' field to your document library table or grid. This will contain a download button, icon or text link. 

The styling and behavior of the document link is controlled by other options, which are described below. 

As well as adding the link field via the list of table columns or grid fields, you can enable it directly in the shortcode as follows:

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

Tip: If you disable the document link then you can still enable the document preview, which appears in the same column/field of the library.

Download button options

Several options for customizing the document link appear in the Download button section of the Display settings page.

Button behavior

This controls whether clicking in the link column will download the file directly or take the user to the single document page, from which they can then download the file. 

You can also configure this 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 download the file directly and also setting any other clickable columns to link to the downloadable field. 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.

Style

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. 

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. 

Icon

Use this to add a download icon which will appear to the left of the link text.

Shortcode options

You can also configure the link style or directly in the shortcode:

  • Link style:
    • [doc_library link_style="button"]
    • [doc_library link_style="link"]
    • [doc_library link_style="file_icon"]
  • Link icon:
    • [doc_library link_icon="true"]
    • [doc_library link_icon="false"]
  • Link text: 
    • [doc_library link_text=""] (leave blank if you want an icon but no link text)
    • [doc_library link_text="Click Here"] (replace "Click Here" with the required link text)

New tab

You can choose whether to open the links 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 also set this directly in the shortcode:

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

Note: This option only affects the main document link field. To make links on other clickable fields open in a new tab, you can enable the separate option in the Advanced settings

In addition to the main document link field, you can make other fields in the document library clickable and control their behavior. The following fields can be formatted as links:

  • idtitle, and image - these fields can link to the single document page.
  • doc_categoriesdoc_tags, doc_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/taxonomy archive page instead.

Choosing which fields are clickable

You can either enable links to other columns globally in the Display settings (in the column editor for table layout, or via the 'Clickable fields' option for grid layout), or by setting the links option 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)
    • 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 as clickable fields 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.

It is also possible to control the destination of the links on other columns in your document library: 

  • For table layout, click the pencil icon for a column and choose where the column will link to. This will generally be to the single document page or to the download file, but other column types - e.g. categories - give you a choice of filtering the table by the clicked term or opening the relevant archive page.
  • For grid layout, use the 'Document title' and 'File name' fields to choose whether these columns link to the single document page or download file. (Note: Other clickable columns such as categories will filter the table by the clicked term, unless you disable search on click which will link it to the relevant archive page instead.)

Search on click

By default, clicking on a document category, tag or custom taxonomy term in the library will search (i.e. filter) the table by that value. 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 or custom taxonomy term, then they will be taken to the relevant category/tag/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.

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 shortcodes 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. Do this by setting content_length=-1 in your shortcode, or in the Advanced plugin settings.

Multi-download buttons

The table layout provides 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 as a zip file. 
  • Both - Display a link to the document and a checkbox. 

You can also configure this directly in the shortcode:

  • [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 text

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

Configure this globally on the plugin settings page.

Button position

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"]

Related Articles

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