'ataglist', 'description' => __('Display advanced tag lists.', 'ataglist') ); /* Widget control settings. */ $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'ataglist-widget' ); /* Create the widget. */ $this->WP_Widget( 'ataglist-widget', __('Advanced Tag List', 'ataglist'), $widget_ops, $control_ops ); } function widget( $args, $instance ) { extract( $args ); global $wpdb; if(($instance['taglist_cat_inc'] == '') && ($instance['taglist_cat_exc'] == '') && ($instance['taglist_tag_exc'] == '')) { /* Do a basic get_tags query if category include/exclude fields are empty */ $orderby = 'name'; switch($instance['taglist_order']) { case 1: $orderby = 'name'; break; case 2: $orderby = 'count&order=DESC'; break; } $number = ($instance['taglist_limit'] != 0) ? '&number=' . $instance['taglist_limit'] : ''; $querystring = 'orderby=' . $orderby . $number; $tags = get_tags($querystring); } else { /* else do an advanced sql query if category include/exclude exists */ $termquery = ''; if($instance['taglist_tag_exc'] != '') { $thetags = explode(",",$instance['taglist_tag_exc']); for($i=0;$iget_results( $query ); } echo $before_widget; if($instance['taglist_title'] != '') { echo $before_title . $instance['taglist_title'] . $after_title; } if($tags) { if($instance['taglist_dropdown'] == 1) { echo '"; } else { echo ''; } } else { echo 'No tags to display.'; } echo $after_widget; } function update( $new_instance, $old_instance ) { $instance = $old_instance; /* Strip tags for title and name to remove HTML (important for text inputs). */ foreach($new_instance as $key => $val) { $instance[$key] = strip_tags( $new_instance[$key] ); } $instance['taglist_show_count'] = ( $new_instance['taglist_show_count'] == 1 ) ? 1 : 0; $instance['taglist_dropdown'] = ( $new_instance['taglist_dropdown'] == 1 ) ? 1 : 0; return $instance; } function form( $instance ) { /* Set up some default widget settings. */ $defaults = array( 'taglist_title' => __( '', 'ataglist' ), 'taglist_show_count' => __( 1, 'ataglist' ), 'taglist_order' => __( 1, 'ataglist' ), 'taglist_limit' => __( 0, 'ataglist' ), 'taglist_dropdown' => __( 0, 'ataglist' ), 'taglist_cat_inc' => __( '', 'ataglist'), 'taglist_cat_exc' => __( '', 'ataglist'), 'taglist_tag_exc' => __( '', 'ataglist') ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

>


(0 = display all tags)


* Exclude field is applied only if Include field is empty.

>