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.