Index: src/wp-includes/default-widgets.php
===================================================================
--- src/wp-includes/default-widgets.php	(revision 31255)
+++ src/wp-includes/default-widgets.php	(working copy)
@@ -705,6 +705,8 @@
 		/** This filter is documented in wp-includes/default-widgets.php */
 		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
 
+		$cpt = isset( $instance['cpt'] ) ? $instance['cpt'] : 'post';
+
 		$number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 5;
 		if ( ! $number )
 			$number = 5;
@@ -720,6 +722,7 @@
 		 * @param array $args An array of arguments used to retrieve the recent posts.
 		 */
 		$r = new WP_Query( apply_filters( 'widget_posts_args', array(
+			'post_type'           => $cpt,
 			'posts_per_page'      => $number,
 			'no_found_rows'       => true,
 			'post_status'         => 'publish',
@@ -760,6 +763,7 @@
 	public function update( $new_instance, $old_instance ) {
 		$instance = $old_instance;
 		$instance['title'] = strip_tags($new_instance['title']);
+		$instance['cpt'] = stripslashes($new_instance['cpt']);
 		$instance['number'] = (int) $new_instance['number'];
 		$instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false;
 		$this->flush_widget_cache();
@@ -776,13 +780,35 @@
 	}
 
 	public function form( $instance ) {
-		$title     = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
-		$number    = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
-		$show_date = isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : false;
+		$cpt_args = apply_filters( 'widget_posts_cpt_args', array(
+            'public'    => true,
+            '_builtin'  => false,
+        ) );
+
+		$title     		= isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
+		$current_cpt    = isset( $instance['cpt'] ) ? $instance['cpt'] : 'post';
+		$number   		= isset( $instance['number'] ) ? absint( $instance['number'] ) : 5;
+		$show_date 		= isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : false;
+		$has_cpts       = !empty( get_post_types( $cpt_args ) ) ? true : false;
 ?>
 		<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
 		<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p>
 
+		<?php // Show post type selector if site has CPT's
+        if( apply_filters( 'widget_posts_cpt_selector', $has_cpts ) ): ?>
+            <p><label for="<?php echo $this->get_field_id('cpt'); ?>"><?php _e('Post type of posts to show:') ?></label>
+            <select class="widefat" id="<?php echo $this->get_field_id('cpt'); ?>" name="<?php echo $this->get_field_name('cpt'); ?>">
+                <option value="any" <?php selected('any', $current_cpt) ?>><?php _e( 'All' ); ?></option>
+                <option value="post" <?php selected('post', $current_cpt) ?>><?php _e( 'Posts' ); ?></option>
+                <?php foreach ( get_post_types( $cpt_args, 'objects' ) as $post_type => $cpt ) :
+                    if ( empty($cpt->labels->name) )
+                        continue;
+                ?>
+                    <option value="<?php echo esc_attr($post_type) ?>" <?php selected($post_type, $current_cpt) ?>><?php echo $cpt->labels->name; ?></option>
+                <?php endforeach; ?>
+            </select></p>
+        <?php endif; ?>
+
 		<p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:' ); ?></label>
 		<input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p>
 
