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' => $instance['hide_empty'], 'orderby' => $instance['orderby'], 'order' => $instance['order']); $categories = get_terms('question_category', $cat_args); ?> <ul id="ap-categories-widget" class="ap-cat-wid clearfix"> <?php foreach ($categories as $key => $category) { $sub_cat_count = count(get_term_children($category->term_id, 'question_category')); ?> <li class="clearfix"> <a class="ap-cat-image" href="<?php echo get_category_link($category); ?> "><?php echo ap_get_category_image($category->term_id); ?> </a> <a class="ap-cat-wid-title" href="<?php echo get_category_link($category); ?> "> <?php echo $category->name; ?> </a> <div class="ap-cat-count"> <span><?php printf(_n('%d Question', '%d Questions', $category->count, 'categories-for-anspress'), $category->count); ?> </span> <?php if ($sub_cat_count > 0) { ?> <span><?php printf(__('%d Child', 'categories-for-anspress'), $sub_cat_count); ?> </span> <?php } ?> </div> </li> <?php } ?> </ul> <?php echo $args['after_widget']; }
"> <div id="ap-categories" class="clearfix"> <ul class="ap-term-category-box clearfix"> <?php foreach ($question_categories as $key => $category) { ?> <li class="clearfix"> <div class="ap-category-item"> <div class="ap-cat-img-c"> <span class="ap-term-count"> <?php printf(_n('%d Question', '%d Questions', 'categories_for_anspress', $category->count), $category->count); ?> </span> <?php echo ap_get_category_image($category->term_id); ?> </div> <div class="ap-term-title"> <a class="term-title" href="<?php echo get_category_link($category); ?> "> <?php echo $category->name; ?> </a> <?php $sub_cat_count = count(get_term_children($category->term_id, 'question_category')); ?>