'geocraft_widget_archive', 'description' => __('A monthly archive of your site’s posts or custom pots')); parent::__construct('geocraft_archives', __('Geocraft Archives'), $widget_ops); } function widget($args, $instance) { extract($args); $c = !empty($instance['count']) ? '1' : '0'; $d = !empty($instance['dropdown']) ? '1' : '0'; $title = apply_filters('widget_title', empty($instance['title']) ? __('Archives') : $instance['title'], $instance, $this->id_base); if (!$show_type = $instance["show_type"]) $show_type = 'post'; echo $before_widget; if ($title) echo $before_title . $title . $after_title; $my_args = array( 'post_type' => $show_type ); $c_posts = new WP_Query($my_args); if ($c_posts->have_posts()): $c_posts->the_post(); if ($d) { ?> '', 'count' => 0, 'dropdown' => '')); $instance['title'] = strip_tags($new_instance['title']); $instance['count'] = $new_instance['count'] ? 1 : 0; $instance['dropdown'] = $new_instance['dropdown'] ? 1 : 0; $instance['show_type'] = esc_attr($new_instance['show_type']); return $instance; } function form($instance) { $instance = wp_parse_args((array) $instance, array('title' => '', 'count' => 0, 'dropdown' => '')); $title = strip_tags($instance['title']); $count = $instance['count'] ? 'checked="checked"' : ''; $dropdown = $instance['dropdown'] ? 'checked="checked"' : ''; $show_type = isset($instance['show_type']) ? esc_attr($instance['show_type']) : 'post'; ?>

id="get_field_id('dropdown'); ?>" name="get_field_name('dropdown'); ?>" />
id="get_field_id('count'); ?>" name="get_field_name('count'); ?>" />