* @license GPL-3.0+ * @link https://anspress.io * @copyright 2014 Rahul Aryan */ namespace Anspress\Widgets; /** * Register AnsPress category widget. * * @since 4.1.8 */ class Categories extends \WP_Widget { /** * Construct */ public function __construct() { // Instantiate the parent object. parent::__construct( 'AnsPress_Category_Widget', '(AnsPress) Categories', array( 'description', __( 'Display AnsPress categories', 'anspress-question-answer' ) ) ); } public function widget( $args, $instance ) { /** * This filter is documented in widgets/question_stats.php */ $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'], ); $icon_width = ! empty( $instance['icon_width'] ) ? $instance['icon_width'] : 32; $icon_height = ! empty( $instance['icon_height'] ) ? $instance['icon_height'] : 32; $categories = get_terms( 'question_category', $cat_args ); ?>
>