0, 'cat_id_2' => 0, 'post_number' => 5, ); return $defaults; } public function __construct() { $opts = array( 'classname' => 'allure-news-cat_column', 'description' => esc_html__('Two Category Column Widget.', 'allure-news'), ); parent::__construct('allure_news_category_column_widget', esc_html__('Allure News Two Category Column', 'allure-news'), $opts); } public function widget($args, $instance) { $instance = wp_parse_args((array)$instance, $this->defaults()); $cat_id_1 = absint($instance['cat_id_1']); $cat_id_2 = absint($instance['cat_id_2']); $post_number = absint($instance['post_number']); $cat1_class = 'cat-' . $cat_id_1; $cat2_class = 'cat-' . $cat_id_2; echo $args['before_widget']; ?>
'name',
'order' => 'asc',
'show_count' => 1,
'hide_empty' => 1,
'echo' => 1,
'selected' => $cat_id_1,
'hierarchical' => 1,
'name' => esc_attr($this->get_field_name('cat_id_1')),
'id' => esc_attr($this->get_field_name('cat_id_1')),
'class' => 'widefat',
'taxonomy' => 'category',
'hide_if_empty' => false,
);
wp_dropdown_categories($allure_news_category_col_1_dropown_cat);
?>
'name',
'order' => 'asc',
'show_count' => 1,
'hide_empty' => 1,
'echo' => 1,
'selected' => $cat_id_2,
'hierarchical' => 1,
'name' => esc_attr($this->get_field_name('cat_id_2')),
'id' => esc_attr($this->get_field_name('cat_id_2')),
'class' => 'widefat',
'taxonomy' => 'category',
'hide_if_empty' => false,
);
wp_dropdown_categories($allure_news_category_col_2_dropown_cat);
?>