<?php 
    documentate_document_loop_start();
    ?>

                <?php 
    documentate_document_subcategories();
    ?>

                <?php 
    while (have_posts()) {
        the_post();
        ?>

                <?php 
        documentate_get_template_part('content', 'document');
        ?>

                <?php 
    }
    // end of the loop.
    ?>

            <?php 
    documentate_document_loop_end();
    ?>

            <?php 
    /**
     * documentate_after_document_loop hook
     *
 /**
  * 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();
     }
 }
/**
 * documentate_before_main_content hook
 *
 * @hooked documentate_output_content_wrapper - 10 (outputs opening divs for the content)
 * @hooked documentate_breadcrumb - 20
 */
do_action('documentate_before_main_content');
?>

        <?php 
while (have_posts()) {
    the_post();
    ?>

            <?php 
    documentate_get_template_part('content', 'single-document');
    ?>

        <?php 
}
// end of the loop.
?>

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