Forked from dparker1005/add_username_hint_at_checkout.php
Last active
March 24, 2025 15:47
-
-
Save kimwhite/3d981e5ad9ccf1643ce2a2de577ee108 to your computer and use it in GitHub Desktop.
Adds a hint under the "Username" field at checkout.
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 // do not copy this line. | |
/** | |
* This recipe Adds a placeholder hint inside the "Username" field at checkout. | |
* | |
* 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_checkout_add_username_placeholder_hint() { | |
?> | |
<script> | |
jQuery(document).ready(function($) { | |
$("#username").attr("placeholder", "Choose wisely — this can't be changed later."); | |
}); | |
</script> | |
<?php | |
} | |
add_action( 'pmpro_checkout_after_username', 'my_pmpro_checkout_add_username_placeholder_hint' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment