My document category pages aren't working
Document Library Pro provides category pages which automatically display documents from the relevant category. You can find the link for each category pages by going to Documents → Categories and clicking the 'View' link for a category.
The category pages work in most WordPress themes, but unfortunately not in block themes or category pages designed using page builders such as Elementor or Divi Builder. If this applies to you then you will need to create the category pages yourself using one of the following methods.
Method 1: Use the Document Library Pro shortcode
Create a page for each category and add a shortcode to list documents from a specific category.
Method 2: Create a custom document archive page
Below, we have provided a code snippet and custom shortcode which you can insert into an archive page created using a page builder in order to list documents from the relevant category. If you don't know how to use it then please view our article on using code snippets, or use our customization service.
Step 1: Add the code snippet
function dynamic_doc_library_shortcode( $atts ) {
$term = get_queried_object();
if ( is_a( $term, 'WP_Term' ) && isset( $term->term_id ) ) {
$category_id = $term->term_id;
} else {
return ;
}
return do_shortcode( '[doc_library doc_category="' . esc_attr( $category_id ) . '"]' );
}
add_shortcode( 'dynamic_doc_library', 'dynamic_doc_library_shortcode' );
Step 2: Add the custom shortcode
Now add the shortcode [dynamic_doc_library] to a code or shortcode block in your chosen page builder. This will display documents from the relevant category.
Optional: Disable automatic taxonomy library pages
If you wish to disable the automatic taxonomy-based document library pages provided by Document Library Pro, you can use the document_library_pro_disable_taxonomy_libraries filter.
Step 1: Add the filter
Add the following code to your site. This should be placed in your theme’s functions.php file or added via a code snippets plugin:
add_filter( 'document_library_pro_disable_taxonomy_libraries', '__return_true' );
Step 2: Verify your custom pages
Once this filter is enabled, the plugin will no longer output document libraries on taxonomy archive pages.