Forked from dparker1005/my_pmpro_add_name_checkout_hints.php
Last active
August 20, 2021 13:44
-
-
Save kimwhite/e125cebfed768d3d9b4c01a10da52402 to your computer and use it in GitHub Desktop.
Adds a hint to the first and last name fields at checkout.
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
<?php // do not copy this line. | |
/** | |
* This recipe will let you add hints to default WordPress fields (also child sponsor fields) | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_default_fields_checkout_hints() { | |
?> | |
<script> | |
jQuery("#username").parent().append("<p><small class='lite'>I am a hint for username.</small></p>"); | |
jQuery("#password").parent().append("<p><small class='lite'>I am a hint for password.</small></p>"); | |
jQuery("#bemail").parent().append("<p><small class='lite'>I am a hint for email.</small></p>"); | |
jQuery("#first_name").parent().append("<p><small class='lite'>I am a hint for first name.</small></p>"); | |
jQuery("#last_name").parent().append("<p><small class='lite'>I am a hint for last name.</small></p>"); | |
jQuery('input[name="add_sub_accounts_username[]"]').after("<p><small class='lite'>child username</small></p>"); | |
jQuery('input[name="add_sub_accounts_email[]"]').after("<p><small class='lite'>child email</small></p>"); | |
jQuery('input[name="add_sub_accounts_password[]"]').after("<p><small class='lite'>child password</small></p>"); | |
</script> | |
<?php | |
} | |
add_action( 'pmpro_checkout_after_billing_fields', 'my_pmpro_default_fields_checkout_hints' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment