'jaw_year_ago_widget_class', 'description' => 'This plugin displays links to the most popular post or posts from one year ago on the sidebar.' ); $this ->WP_Widget('jaw_year_ago_my_info', 'A Year Ago Today', $widget_ops); } function form($instance){ $defaults = array('title' => 'A Year Ago Today', 'number_of_posts' => 1); $instance = wp_parse_args( (array) $instance, $defaults); $title=$instance['title']; $number_of_posts=$instance['number_of_posts']; ?>

Title:

Number of Posts:

0){ $instance['number_of_posts'] = $new_instance['number_of_posts']; } else { $instance['number_of_posts'] = 1; } return $instance; } function widget($args, $instance){ extract($args); $title=apply_filters( 'widget_title', $instance['title']); echo $before_widget; if (empty($instance['number_of_posts'])){ $number_of_posts=1; } else { $number_of_posts=$instance['number_of_posts']; } $current_month = date_i18n('m'); $current_day = date_i18n('j'); $lastyear = date('Y')-1; $custom_loop = new WP_Query(); $custom_loop -> query('showposts=' . $number_of_posts . '&year=' . $lastyear . '&monthnum=' . $current_month . '&day=' . $current_day . '&orderby=comment_count'); if ( $custom_loop->have_posts() ) {?> '; } echo $after_widget; } }