Created
December 23, 2022 07:19
-
-
Save mwangepatrick/89879c4d86b944fa9184d00271483f4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$current_date = date( 'md' ); // first load the current date into a variable, formatted as md | |
$employee_birthdays = new WP_Query( | |
array( | |
'posts_per_page' => -1, | |
'post_type' => 'member', // employee | |
'meta_query' => array( | |
array( | |
'key' => 'birthday', // assumes the date picker field is called birthday. Stored in Ymd format. | |
'value' => '\d\d\d\d'.$current_date, | |
'compare' => 'REGEXP', | |
), | |
), | |
) | |
); | |
while ( $employee_birthdays->have_posts() ) { | |
$employee_birthdays->the_post(); | |
echo '<li>' . get_the_title() . ' : '.get_field('birthday', get_the_ID()).'</li>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment