Add "week" as a filtering option to Birthdays widget

This commit is contained in:
savvasha
2018-07-30 16:40:07 +03:00
parent c8414b0689
commit ce4389bee9
2 changed files with 6 additions and 0 deletions

View File

@@ -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' ),
);

View File

@@ -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 ) {