Ticket #40203: 40203.patch
File 40203.patch, 3.2 KB (added by , 7 years ago) |
---|
-
src/wp-includes/widgets/class-wp-widget-recent-posts.php
56 56 if ( ! $number ) 57 57 $number = 5; 58 58 $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; 59 $show_thumbnail = isset( $instance['show_thumbnail'] ) ? $instance['show_thumbnail'] : false; 59 60 60 61 /** 61 62 * Filters the arguments for the Recent Posts widget. … … 82 83 <ul> 83 84 <?php while ( $r->have_posts() ) : $r->the_post(); ?> 84 85 <li> 86 <?php if ( $show_thumbnail && has_post_thumbnail() ) : 87 the_post_thumbnail( 'thumbnail' ); 88 endif; ?> 85 89 <a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a> 86 90 <?php if ( $show_date ) : ?> 87 91 <span class="post-date"><?php echo get_the_date(); ?></span> … … 113 117 $instance['title'] = sanitize_text_field( $new_instance['title'] ); 114 118 $instance['number'] = (int) $new_instance['number']; 115 119 $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false; 120 $instance['show_thumbnail'] = isset( $new_instance['show_thumbnail'] ) ? (bool) $new_instance['show_thumbnail'] : false; 116 121 return $instance; 117 122 } 118 123 … … 128 133 $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 129 134 $number = isset( $instance['number'] ) ? absint( $instance['number'] ) : 5; 130 135 $show_date = isset( $instance['show_date'] ) ? (bool) $instance['show_date'] : false; 136 $show_thumbnail = isset( $instance['show_thumbnail'] ) ? (bool) $instance['show_thumbnail'] : false; 131 137 ?> 132 138 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> 133 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" placeholder="<?php esc_attr_e( 'Recent Posts' ); ?>"type="text" value="<?php echo $title; ?>" /></p>139 <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> 134 140 135 141 <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:' ); ?></label> 136 142 <input class="tiny-text" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="number" step="1" min="1" value="<?php echo $number; ?>" size="3" /></p> … … 137 143 138 144 <p><input class="checkbox" type="checkbox"<?php checked( $show_date ); ?> id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" /> 139 145 <label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Display post date?' ); ?></label></p> 146 147 <p><input class="checkbox" type="checkbox"<?php checked( $show_thumbnail ); ?> id="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>" name="<?php echo $this->get_field_name( 'show_thumbnail' ); ?>" /> 148 <label for="<?php echo $this->get_field_id( 'show_thumbnail' ); ?>"><?php _e( 'Display post thumbnail?' ); ?></label></p> 140 149 <?php 141 150 } 142 151 }