Update WP and plugins

This commit is contained in:
Oliver Davies 2019-04-16 20:56:22 +01:00
parent 10a4713229
commit 1fb77fc4ff
864 changed files with 101724 additions and 78262 deletions

View file

@ -23,8 +23,8 @@ class WP_Widget_Recent_Posts extends WP_Widget {
*/
public function __construct() {
$widget_ops = array(
'classname' => 'widget_recent_entries',
'description' => __( 'Your site’s most recent Posts.' ),
'classname' => 'widget_recent_entries',
'description' => __( 'Your site’s most recent Posts.' ),
'customize_selective_refresh' => true,
);
parent::__construct( 'recent-posts', __( 'Recent Posts' ), $widget_ops );
@ -67,12 +67,18 @@ class WP_Widget_Recent_Posts extends WP_Widget {
* @param array $args An array of arguments used to retrieve the recent posts.
* @param array $instance Array of settings for the current widget.
*/
$r = new WP_Query( apply_filters( 'widget_posts_args', array(
'posts_per_page' => $number,
'no_found_rows' => true,
'post_status' => 'publish',
'ignore_sticky_posts' => true,
), $instance ) );
$r = new WP_Query(
apply_filters(
'widget_posts_args',
array(
'posts_per_page' => $number,
'no_found_rows' => true,
'post_status' => 'publish',
'ignore_sticky_posts' => true,
),
$instance
)
);
if ( ! $r->have_posts() ) {
return;
@ -91,7 +97,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
$title = ( ! empty( $post_title ) ) ? $post_title : __( '(no title)' );
?>
<li>
<a href="<?php the_permalink( $recent_post->ID ); ?>"><?php echo $title ; ?></a>
<a href="<?php the_permalink( $recent_post->ID ); ?>"><?php echo $title; ?></a>
<?php if ( $show_date ) : ?>
<span class="post-date"><?php echo get_the_date( '', $recent_post->ID ); ?></span>
<?php endif; ?>
@ -113,9 +119,9 @@ class WP_Widget_Recent_Posts extends WP_Widget {
* @return array Updated settings to save.
*/
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['number'] = (int) $new_instance['number'];
$instance = $old_instance;
$instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['number'] = (int) $new_instance['number'];
$instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false;
return $instance;
}
@ -131,7 +137,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
$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;
?>
?>
<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>
@ -140,6 +146,6 @@ class WP_Widget_Recent_Posts extends WP_Widget {
<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' ); ?>" />
<label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Display post date?' ); ?></label></p>
<?php
<?php
}
}