Пример #1
0
 public function widget($args, $instance)
 {
     if (!empty($instance['taxonomy'])) {
         $this->taxonomy = $instance['taxonomy'];
     }
     add_filter('widget_categories_dropdown_args', array($this, 'add_taxonomy_dropdown_args'), 10);
     add_filter('widget_categories_args', array($this, 'add_taxonomy_dropdown_args'), 10);
     parent::widget($args, $instance);
 }
Пример #2
0
 /**
  * Displays the content of the widget
  *
  * Temporarly adds and remove filters and use parent category widget display
  *
  * @param  array  $args
  * @param  array  $instance
  * @uses   WP_Widget_Categories::widget() to display the widget
  */
 public function widget($args = array(), $instance = array())
 {
     // Add filter so that the taxonomy used is cat-ideas
     add_filter('widget_categories_args', array($this, 'use_ideas_category'));
     // Use WP_Widget_Categories::widget()
     parent::widget($args, $instance);
     // Remove filter to reset the taxonomy for other widgets
     add_filter('widget_categories_args', array($this, 'use_ideas_category'));
 }