Example #1
0
 public function __construct()
 {
     parent::WP_Widget(false, "* Metro Category Tiles", "description=" . __("List of categories that will be styled like Metro Tiles", "metro"));
 }
Example #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'));
 }
Example #3
0
        public function form($instance)
        {
            parent::form($instance);
            $taxonomy = 'category';
            if (!empty($instance['taxonomy'])) {
                $taxonomy = $instance['taxonomy'];
            }
            $taxonomies = $this->get_taxonomies();
            ?>
        <p>
            <label for="<?php 
            echo $this->get_field_id('taxonomy');
            ?>
"><?php 
            _e('Taxonomy:');
            ?>
</label><br />
            <select id="<?php 
            echo $this->get_field_id('taxonomy');
            ?>
" name="<?php 
            echo $this->get_field_name('taxonomy');
            ?>
">
                <?php 
            foreach ($taxonomies as $value) {
                ?>
                <option value="<?php 
                echo esc_attr($value);
                ?>
"<?php 
                selected($taxonomy, $value);
                ?>
><?php 
                echo esc_attr($value);
                ?>
</option>
                <?php 
            }
            ?>
            </select>
        </p>
        <?php 
        }
Example #4
0
 public function __construct()
 {
     $params = ['classname' => 'widget_categories', 'description' => __("A list or dropdown of categories.", THEME_TEXT_DOMAIN), 'name' => __('Search Widget', THEME_TEXT_DOMAIN)];
     parent::__construct('categories', __('Categories'), $params);
 }