'widget_recent_entries', 'description' => __('Display a list of recent post entries with a specific illustration.')); parent::__construct('illustrated-recent-posts', __('Illustrated Recent Posts'), $widget_ops); } /* PURE */ function find_first_image($content) { $first_img = ''; $output = preg_match_all('//i', $content, $matches); if (!($output === false)) { $first_img = $matches[1][0]; } return $first_img; } function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? 'Recent Posts' : $instance['title'], $instance, $this->id_base); $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; if (empty($instance['number']) || (!($number = absint($instance['number'])))) { $number = 5; } if(!($c = $instance["cats"])) { $c = ''; } $irpw_args=array( 'showposts' => $count, 'category__in'=> $c, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ); $irp_widget = new WP_Query($irpw_args); echo $before_widget; while ($irp_widget->have_posts()) { $irp_widget->the_post(); $first_image = find_first_image($post->post_content); ?>

/