Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $current_month = date( 'n' ); // 1-12
- $current_day = date( 'j' ); // 1-31
- $next_month = date('n', strtotime('next month'));
- $day_span = 28 - $current_day;
- $args_birthday_current = [
- 'role__in' => ['subscriber'],
- //'order' => 'ASC',
- 'orderby' => ['birth_day' =>'ASC', /*'birth_month' =>'ASC'*/],
- 'meta_query' => array(
- 'relation' => 'OR',
- array( 'relation' => 'AND',
- 'birth_month' => array(
- 'key' => 'birth_date_month',
- 'value' => $current_month,
- 'compare' => '=',
- ),
- 'birth_day' => array(
- 'key' => 'birth_date_day',
- 'value' => $current_day,
- 'compare' => '>=',
- ),
- ),
- array( 'relation' => 'AND',
- 'next_month' => array(
- 'key' => 'birth_date_month',
- 'value' => $next_month,
- 'compare' => '=',
- ),
- 'day_span' => array(
- 'key' => 'birth_date_day',
- 'value' => $day_span,
- 'compare' => '>=',
- ),
- ),
- ),
- ];
- foreach ( $user_query->get_results() as $user ) {
- $birth_date_month_number = get_user_meta($user->ID, 'birth_date_month', true);
- $birth_date_day_number = get_user_meta($user->ID, 'birth_date_day', true);
- $birthday = date('F jS', mktime(0, 0, 0, $birth_date_month_number, $birth_date_day_number, 0));
- $user_id = "user_".$user->ID;
- $badge = get_field('user_profile_photo', $user_id);
- echo '<a class="profile-link" href="profile-page/user/index.php?user=' . $user->last_name . '"><div>';
- echo '<div class="thumbnail-wrapper"><img class="img-fluid small-thumb" src="' . $badge['sizes']['thumbnail'] . '" alt="' . $badge['alt'] . '" /></div>';
- echo '<div class="profile-wrapper">' . $user->first_name . ' ' . $user->last_name . '<br>' . $birthday . '</div>';
- echo '</div></a>';
- }
Add Comment
Please, Sign In to add comment