1. Home
  2. Knowledge Base
  3. Document Library Pro
  4. Advanced Usage

How to display category descriptions in folder view

By default, folder view in Document Library Pro lists document categories as expandable folders, but it does not show the category description. This article explains how to display each document category's description inside its folder.

If you're new to adding code snippets, see our short guide or request a quote from our customization service for assistance.

Adding the description

The text comes from the standard WordPress term description field for each document category. To edit it, go to Documents → Categories, choose the category, and add your content in the Description field.

This applies to document categories used in folder view. Categories with an empty description show nothing extra, and no empty description element is added.

Code snippet

Add the following snippet to enable category descriptions in folders:

add_filter( 'document_library_pro_should_display_category_description_in_folder', '__return_true' );

Once added, the setting applies to every folder library on the site. The description appears directly under the folder name, and it stays visible whether the folder is open or closed.

The Uncategorized category never shows a description, even when this filter is enabled.

Styling the description

The description is wrapped in an element with the class dlp-category-description, so you can control its appearance with custom CSS. For example:

.dlp-category-description {
font-size: 0.9em;
color: #666;
margin-top: 0.25em;
}

Add this CSS to your theme or custom CSS area to adjust the size, color, or spacing.

Using shortcodes

Shortcodes inside the category description are executed. This means you can add a shortcode to the description field if you need the folder description to output dynamic content.

Related Articles

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