Document folders
The folders option in Document Library Pro controls the overall structure of your document libraries.
Folders disabled
This is the default option and lists all your documents together, regardless of their category. You can disable folders on the plugin settings page, or by adding folders="false"
to the shortcode, for example: [doc_library folders="false"]
Folders enabled
This structures your document library into a hierarchical folder tree structure listing the document categories, sub-categories, and so on. The tree view allows users to drill down into the document library by category.
When the user clicks on a folder, they will see a list of documents from that category and/or folders for the sub-categories. The user can then click on a sub-category to view a list of documents in the sub-category, and so on.
The folders are collapsible and only one folder will ever be open at a time. This helps to make the document library easy to navigate, so that the user never gets lost.
You can enable folders on the plugin settings page, or by adding folders="true"
to the shortcode, for example: [doc_library folders="true"]
Folder status
By default, the folders are all closed when the document library first loads. You can use the folder status option to change this - either to display all the folders as open, or by specifying individual folders which will be open while the others are closed. To do this, either use the Open folders option on the plugin settings page, or the folder_status shortcode option.
To control the folder status in the shortcode, add open, closed, or a comma-separated list of category ID's. Examples:
[doc_library folder_status="open"]
[doc_library folder_status="closed"]
[doc_library folder_status="123,456,789"]
- this assumes that 3 categories with the ID's 123, 456 and 789 will be open by default. You can find the category ID's by going to Documents → Categories, clicking to Edit the category, and looking for the ID in the URL in the address bar of your browser. For example, if the URL ends with /wp-admin/term.php?taxonomy=doc_categories&tag_ID=900&post_type=dlp_document then the category ID is 900.
Adding your own folder icon
Document Library Pro comes with a folder icon built-in. Top level folders are yellow, and sub-folders are black.
You can use the options on the settings page to change color of the folder icons, or replace them with your own icon.
Choosing which categories to include in the list of folders
By default, all your document categories will be included in the list of folder.
For more fine-grained control, you can choose which categories to include as follows:
- Use the doc_category shortcode option to list specific categories to include.
- Use the exclude_doc_category shortcode option to exclude specific categories.
Changing the sort order of folders
There are several ways to re-order the list of folders. Please see our separate article about this.
FAQ
Does it support sub-categories?
Yes, sub-categories will be indented to show the folder structure. You can have as many levels of categories as you like, and the child categories will always be nested under their parent category. Of course, this assumes that the page is wide enough to accommodate deep category structures with many levels!
If a category has documents AND sub-categories, then it will show like this:
- Category 1
- List of documents that are in category 1 but not any of its sub-categories
- Category 1a name and folder icon
- List of documents in category 1a
Can a document appear in multiple folders?
Yes, if a document is in multiple categories then it will appear in multiple folders, under each of its categories. The exception is if it is in a parent category and its child category, in which case it will only appear in the child category.
Can I add a search option to the folder view?
Yes, if you enable the search box on the plugin settings page then this will appear above the list of folders. That way, users can search within all the folders at once.
The results will appear as a flat list of documents and will not be structured into folders. Users can use the 'Reset' button to return to the folder review.
Learn more about the logic of the search box when you use the folders option.
Can I show the categories description in the folders list?
Yes, you can show the category descriptions in the folders list. Please refer to our article on how to use code snippets, and add the following code:
add_filter( 'document_library_pro_should_display_category_description_in_folder', '__return_true' );