Last active
November 5, 2020 04:03
-
-
Save BoyetDgte/074c33d41ab3489aea28bf9a99afe3cd to your computer and use it in GitHub Desktop.
Modify date range for BuddyPress Xprofile Custom Fields Type - Birthdate Selector (Starting at year 1930)
This file contains hidden or 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
function custom_bxcft_birthdate_year($html, $type, $day, $month, $year, $field_id, $date) { | |
if($type == 'year'){ | |
$html = '<option value=""' . selected( $year, '', false ) . '>----</option>'; | |
for ( $i = date('Y', time()-60*60*24); $i > 1929; $i-- ) { | |
$html .= '<option value="' . $i .'"' . selected( $year, $i, false ) . '>' . $i . '</option>'; | |
} | |
} | |
return $html; | |
} | |
add_filter( 'bp_get_the_profile_field_birthdate', 'custom_bxcft_birthdate_year',10,7); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment