From ce4389bee931aef040223ead9bc9f938879c08e8 Mon Sep 17 00:00:00 2001 From: savvasha Date: Mon, 30 Jul 2018 16:40:07 +0300 Subject: [PATCH] Add "week" as a filtering option to Birthdays widget --- includes/widgets/class-sp-widget-birthdays.php | 1 + templates/birthdays.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/includes/widgets/class-sp-widget-birthdays.php b/includes/widgets/class-sp-widget-birthdays.php index 98c999b3..3e3bcdef 100644 --- a/includes/widgets/class-sp-widget-birthdays.php +++ b/includes/widgets/class-sp-widget-birthdays.php @@ -46,6 +46,7 @@ class SP_Widget_Birthdays extends WP_Widget { $date = strip_tags($instance['date']); $options = array( 'day' => __( 'Today', 'sportspress' ), + 'week' => __( 'This week', 'sportspress' ), 'month' => __( 'This month', 'sportspress' ), ); diff --git a/templates/birthdays.php b/templates/birthdays.php index 072efaee..443f997f 100644 --- a/templates/birthdays.php +++ b/templates/birthdays.php @@ -37,6 +37,11 @@ if ( $date == 'day' ) { $args['day'] = date('j'); } +if ( $date == 'week' ) { + $args['year'] = date( 'Y' ); + $args['week'] = date( 'W' ); +} + $posts = get_posts( $args ); foreach ( $posts as $post ) {