Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipokkel/37cef63a22cf98d071dc134aa6cc18fd to your computer and use it in GitHub Desktop.
Save ipokkel/37cef63a22cf98d071dc134aa6cc18fd to your computer and use it in GitHub Desktop.
Paid Memberships Pro Register Helper: Add t-shirt sizes as selection
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: https://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for my Paid Memberships Pro Setup
Version: .1
Author: Paid Memberships Pro
Author URI: https://www.paidmembershipspro.com
*/
//Now start placing your customization code below this line
/**
* This adds fields to your Paid Memberships Pro checkout and profile page.
* Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
* www.paidmembershipspro.com
*/
function my_pmprorh_init()
{
//don't break if Register Helper is not loaded
if(!function_exists( 'pmprorh_add_registration_field' )) {
return false;
}
// To change the Heading displayed above your custom fields replace "Personal Information" with your preferred heading
pmprorh_add_checkout_box("personal", "Personal Information");
$fields = array();
$fields[] = new PMProRH_Field(
'tshirtsize',
'select',
array(
'label' => 'T Shirt Size',
'options' => array(
'' => '- Select -',
'small' => 'Small',
'medium'=> 'Medium',
'large'=> 'Large',
'xlarge'=> 'X-Large',
),
'required' => true,
'profile' => true,
// 'memberslistcsv' => true, // Uncomment to include in Memberlist CSV
// "addmember" => true, // Uncomment if using the Admin Add Member plugin
)
);
//add the fields into a new checkout_boxes are of the checkout page
foreach($fields as $field)
pmprorh_add_registration_field(
'personal', // 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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment