Last active
July 27, 2021 08:15
-
-
Save femiyb/87e0731b4c0c4f3c0583d1a7b6968807 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 | |
/** | |
* For more information on the Register Helper Add-on please visit https://www.paidmembershipspro.com/add-ons/free-add-ons/pmpro-register-helper-add-* checkout-and-profile-fields/ | |
* Add the following code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
**/ | |
function my_pmprorh_init_custom_field() | |
{ | |
//don't break if Register Helper is not loaded | |
if(!function_exists("pmprorh_add_registration_field")) | |
{ | |
return false; | |
} | |
//define the fields | |
$fields = array(); | |
// TEXT AREA | |
$fields[] = new PMProRH_Field( | |
"info_about_us", // input name, will also be used as meta key | |
"textarea", // type of field | |
array( | |
'label' => 'How did you hear about us', // custom field label | |
'required' => true, // make field required, set value to false to make it optional | |
'size' => 100, // input size | |
'profile' => true, | |
'addmember' => true, | |
'memberslistcsv' => true, | |
) | |
); | |
foreach($fields as $field) | |
pmprorh_add_registration_field( | |
"checkout_boxes", // location on checkout page | |
$field // PMProRH_Field object | |
); | |
//that's it. see the PMPro Register Helper readme for more information and examples. | |
} | |
add_action("init", "my_pmprorh_init_custom_field"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment