Created
October 2, 2017 01:26
-
-
Save pbrocks/0ea1d996ab1d931678656d5dfed2afe1 to your computer and use it in GitHub Desktop.
Adding two custom fields for PMPro Register Helper Add On
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
/** | |
* Adding additional PMPro Register Helper Fields | |
*/ | |
function pmpro_additional_wp_user_checkout_fields() { | |
if ( class_exists( 'PMProRH_Field' ) ) { | |
pmprorh_add_checkout_box( 'additional', 'Additional Information' ); | |
$fields = array(); | |
/** | |
* Team Name field | |
*/ | |
$fields[] = new PMProRH_Field( | |
'team_name', | |
'select', | |
array( | |
'label' => 'Team Name', | |
'options' => array( | |
'tigers' => 'Tigers', | |
'bears' => 'Bears', | |
), | |
'size' => 40, | |
'profile' => true, | |
'required' => false, | |
) | |
); | |
/** | |
* Redirect URL field | |
*/ | |
$fields[] = new PMProRH_Field( | |
'redirect_url', | |
'text', | |
array( | |
'label' => 'Redirect URL', | |
'size' => 40, | |
'profile' => true, | |
'required' => false, | |
) | |
); | |
foreach ( $fields as $field ) { | |
pmprorh_add_registration_field( 'additional', $field ); | |
} | |
} | |
} | |
add_action( 'init', 'pmpro_additional_wp_user_checkout_fields' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment