public function widget($args, $instance) { $title = apply_filters('widget_title', $instance['title']); echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } $cat_args = array('parent' => $instance['parent'], 'number' => $instance['number'], 'hide_empty' => false, 'orderby' => $instance['orderby'], 'order' => $instance['order']); $categories = get_terms('question_category', $cat_args); ?> <ul class="ap-categories-list"> <?php foreach ($categories as $key => $category) { $sub_cat_count = count(get_term_children($category->term_id, 'question_category')); ?> <li> <a class="term-title ap-icon-category" href="<?php echo get_category_link($category); ?> "><?php echo $category->name; ?> <span><?php echo $category->count; ?> </span> <?php if ($sub_cat_count > 0) { ?> <i class="ap-icon-arrow-down"></i> <?php } ?> </a> <?php if ($sub_cat_count > 0) { echo '<div class="ap-term-sub">'; echo '<div class="sub-cat-count">' . $sub_cat_count . ' ' . __('Sub Categories', 'ap') . '</div>'; ap_child_cat_list($category->term_id); echo '</div>'; } ?> </li> <?php } ?> </ul> <?php echo $args['after_widget']; }
</span></a> <span> × <?php echo $category->count; ?> </span> <p><?php echo ap_truncate_chars($category->description, 70); ?> </p> <?php $sub_cat_count = count(get_term_children($category->term_id, 'question_category')); if ($sub_cat_count > 0) { echo '<div class="ap-term-sub">'; echo '<div class="sub-cat-count">' . $sub_cat_count . ' ' . __('Sub Categories', 'ap') . '</div>'; ap_child_cat_list($category->term_id); echo '</div>'; } ?> </div> </li> <?php } ?> </ul> </div> <?php } else { ?> <div class="ap-tax-disabled"> <?php