'widget_categories', 'description' => __( "A list or dropdown of categories / and optiionally custom taxonomy categories" ) ); $this->WP_Widget('tax_categories', __('* Tax / Categories'), $widget_ops); } function widget( $args, $instance ) { extract( $args ); $title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Custom Categories' ) : $instance['title'], $instance, $this->id_base); $taxcats = $instance['taxcats']; // *** $taxcats $instance $c = $instance['count'] ? '1' : '0'; $h = $instance['hierarchical'] ? '1' : '0'; $d = $instance['dropdown'] ? '1' : '0'; echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; // In case a custom taxonomy that this widget was set to use got deactivated, // then SET it to use the widget's default / 'category' ( for Posts ) if ( !taxonomy_exists($taxcats) ) $taxcats = 'category'; $cat_args = array('taxonomy' => $taxcats, 'orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); if ( $d ) { $cat_args['show_option_none'] = __('Select Category'); wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args)); ?>
true, 'public' => true, '_builtin' => false, ); // IF custom hierarchical taxonomies exist if( get_taxonomies( $args ) ) { // array to collect custom hierarchical taxonomies $custom_cats = (array) $custom_cats; // collect each custom hierarchical taxonomy foreach( get_taxonomies( $args ) as $custom_tax ) $custom_cats[] = $custom_tax; $current_taxcats = $instance['taxcats']; // *** $taxcats $instance // provide option to use the custom hierarchical taxonomies for this widget ?>
/>
/>
/>