Guest User

Untitled

a guest
Feb 18th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. $current_month = date( 'n' ); // 1-12
  2. $current_day = date( 'j' ); // 1-31
  3. $next_month = date('n', strtotime('next month'));
  4. $day_span = 28 - $current_day;
  5.  
  6. $args_birthday_current = [
  7. 'role__in' => ['subscriber'],
  8. //'order' => 'ASC',
  9. 'orderby' => ['birth_day' =>'ASC', /*'birth_month' =>'ASC'*/],
  10. 'meta_query' => array(
  11.  
  12. 'relation' => 'OR',
  13.  
  14. array( 'relation' => 'AND',
  15.  
  16. 'birth_month' => array(
  17. 'key' => 'birth_date_month',
  18. 'value' => $current_month,
  19. 'compare' => '=',
  20. ),
  21.  
  22. 'birth_day' => array(
  23. 'key' => 'birth_date_day',
  24. 'value' => $current_day,
  25. 'compare' => '>=',
  26. ),
  27.  
  28. ),
  29.  
  30. array( 'relation' => 'AND',
  31.  
  32. 'next_month' => array(
  33. 'key' => 'birth_date_month',
  34. 'value' => $next_month,
  35. 'compare' => '=',
  36. ),
  37.  
  38. 'day_span' => array(
  39. 'key' => 'birth_date_day',
  40. 'value' => $day_span,
  41. 'compare' => '>=',
  42. ),
  43.  
  44. ),
  45. ),
  46. ];
  47.  
  48. foreach ( $user_query->get_results() as $user ) {
  49.  
  50. $birth_date_month_number = get_user_meta($user->ID, 'birth_date_month', true);
  51. $birth_date_day_number = get_user_meta($user->ID, 'birth_date_day', true);
  52. $birthday = date('F jS', mktime(0, 0, 0, $birth_date_month_number, $birth_date_day_number, 0));
  53.  
  54. $user_id = "user_".$user->ID;
  55. $badge = get_field('user_profile_photo', $user_id);
  56. echo '<a class="profile-link" href="profile-page/user/index.php?user=' . $user->last_name . '"><div>';
  57. echo '<div class="thumbnail-wrapper"><img class="img-fluid small-thumb" src="' . $badge['sizes']['thumbnail'] . '" alt="' . $badge['alt'] . '" /></div>';
  58. echo '<div class="profile-wrapper">' . $user->first_name . ' ' . $user->last_name . '<br>' . $birthday . '</div>';
  59. echo '</div></a>';
  60. }
Add Comment
Please, Sign In to add comment