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 column in the document library contains a button, a file type icon, or a text link.

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="icon"]
  • [doc_library link_style="link"]

Use this option to control the text that appears in the link column 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"]

When someone clicks on a link in the link column, 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 column. 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 columns 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 column.

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 column. 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 columns

The clickable columns option lets you control which columns of the document library - if any - are clickable. This option does not affect the link column, which is always clickable. The following columns can be formatted as links:

  • idtitle, and image - these columns can link to the single document page.
  • doc_categoriesdoc_tagsauthor, 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 columns are clickable

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

  • Use all to make all possible columns 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 column will be clickable (links to post)
    • image - The image column (links to post)
    • title - The title column (links to post)
    • author - The author column (links to author archive page)
    • doc_categories - The categories column (links to category archive page)
    • doc_tags - The tags column (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 columns option on the settings page, then only the title and categories columns will be clickable. Example shortcodes:

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

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

Document Library Pro is only designed to allow people to access the document directly from the link column, or from the single document page. If you would like the links on other columns 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.

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

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

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