$col = 'col2'; break; case '3': $col = 'col3'; break; case '4': $col = 'col4'; break; default: $col = 'col1'; break; } // display search form $search = esc_attr($docu_atts['search']); if ($search && $search == 'true') { $template = new DOCU_Template_Loader(); $template->get_template_part('docu-search-form'); } ?> <div class="docu-container"> <div class="docu-wrapper"> <?php do_action('docu_before_index_content'); ?> <div class="items"> <?php $taxonomies = array('doc_category');
public function widget($args, $instance) { do_action('docu_before_sidebar_widget'); $title = apply_filters('docu_widget_title', $instance['title']); echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } echo '<div class="docu-container-category">'; echo '<div class="docu-nav-container">'; // display search form $display_search_form = $instance['display_search_form']; if ($display_search_form && $display_search_form == '1') { $template = new DOCU_Template_Loader(); $template->get_template_part('docu-search-form'); } // list documents $list_documents = $instance['list_documents']; if ($list_documents) { // display a list of all doc categories // for each category, display a list of all documents in the category echo '<ul class="docu-nav-list">'; $taxonomies = array('doc_category'); $tax_args = array('orderby' => 'term_group', 'order' => 'ASC'); $terms = get_terms($taxonomies, $tax_args); foreach ($terms as $term) { ?> <li> <a class="docu-item-link" href="<?php echo get_term_link($term); ?> "><?php echo $term->name; ?> </a> <?php $term_id = $term->term_id; $term_args = array('post_type' => 'doc', 'post_status' => 'publish', 'tax_query' => array(array('taxonomy' => 'doc_category', 'field' => 'id', 'terms' => array($term_id))), 'orderby' => 'menu_order', 'order' => 'ASC'); $the_query = new WP_Query($term_args); if ($the_query->have_posts()) { ?> <ul> <?php while ($the_query->have_posts()) { $the_query->the_post(); ?> <li><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></li> <?php } ?> </ul> <?php } wp_reset_postdata(); ?> </li> <?php } echo '</ul>'; } else { // display a list of all doc categories echo '<ul class="docu-nav-list">'; $cat_args = array('show_option_all' => '', 'orderby' => 'term_group', 'order' => 'ASC', 'style' => 'list', 'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_type' => '', 'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'include' => '', 'hierarchical' => 1, 'title_li' => '', 'show_option_none' => '', 'number' => null, 'echo' => 1, 'depth' => 0, 'current_category' => 0, 'pad_counts' => 0, 'taxonomy' => 'doc_category', 'walker' => null); echo wp_list_categories(apply_filters('docu_list_categories_args', $cat_args)); echo '</ul>'; } echo '</div>'; echo '</div>'; echo $args['after_widget']; do_action('docu_after_sidebar_widget'); }
/** * load docu-prevnext-nav.php template */ function docu_prevnext_nav() { $template = new DOCU_Template_Loader(); $template->get_template_part('docu-prevnext-nav'); }