Last active
April 24, 2020 13:33
-
-
Save messica/3f9a654d87c5282a3d2a to your computer and use it in GitHub Desktop.
Additional TOS Page example for Register Helper
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 | |
/* | |
* Additional Terms of Service Page example for Register Helper | |
* applies formatting & shortcodes, uses post title for field label | |
*/ | |
function my_pmprorh_init() | |
{ | |
// Set additional Terms of Service post ID here. | |
$tos_page = 4; | |
$post = get_post($tos_page); | |
$content = apply_filters('the_content', $post->post_content); | |
$html = '<div id="pmpro_license">' . $content . '</div> | |
<input type="checkbox" name="custom_tos" value="1" id="custom_tos" /> <label class="pmpro_normal pmpro_clickable" for="custom_tos">I Agree</label> | |
'; | |
$field = new PMProRH_Field('custom_tos', 'html', array( | |
'html' => $html, | |
'label' => $post->post_title, | |
'required' => true, | |
'class' => 'custom_tos' | |
)); | |
//add field to checkout page | |
pmprorh_add_registration_field('checkout_boxes', $field); | |
} | |
add_action('init', 'my_pmprorh_init'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment