/**
  * Show subcategory thumbnails.
  *
  * @param mixed $category
  * @subpackage  Loop
  */
 function documentate_subcategory_documents($category)
 {
     $number_docs = intval(documentate_get_option('docu_qty'));
     if ($number_docs > 0) {
         if (false === ($documents = get_transient('documentate_posts_in_' . $category->slug))) {
             $args = array('post_type' => 'document', 'posts_per_page' => $number_docs, 'orderby' => 'menu_order', 'order' => 'ASC', 'tax_query' => array(array('taxonomy' => 'docu_cat', 'field' => 'slug', 'terms' => $category->slug)));
             $documents = new WP_Query(apply_filters('documentate_category_documents', $args, $category));
             set_transient('documentate_posts_in_' . $category->slug, $documents);
         }
         if ($documents->have_posts()) {
             documentate_document_loop_start();
             while ($documents->have_posts()) {
                 $documents->the_post();
                 documentate_get_template_part('content', 'document');
             }
             // end of the loop.
             documentate_document_loop_end();
         }
         wp_reset_postdata();
     }
 }
            <?php 
    documentate_document_loop_end();
    ?>

            <?php 
    /**
     * documentate_after_document_loop hook
     *
     * @hooked documentate_pagination - 10
     */
    do_action('documentate_after_document_loop');
    ?>

        <?php 
} elseif (!documentate_document_subcategories(array('before' => documentate_document_loop_start(false), 'after' => documentate_document_loop_end(false)))) {
    ?>

            <?php 
    documentate_get_template('loop/no-documents-found.php');
    ?>

        <?php 
}
?>

    <?php 
/**
 * documentate_after_main_content hook
 *
 * @hooked documentate_output_content_wrapper_end - 10 (outputs closing divs for the content)