-
-
Save MaryOJob/0bf2ccdcb327f764a22321c78f5436f5 to your computer and use it in GitHub Desktop.
This Code Gist Will Move the Fields in this order, First Name, Last Name, Email Address and Password When using the Code to Generate a username at PMPro checkout from email for users and hiding the username field with CSS - Links for this below
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 | |
/** | |
* Add the following code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_move_name_fields() { | |
global $pmpro_pages; | |
if(is_page($pmpro_pages['checkout'])) { | |
?> | |
<script> | |
jQuery( '.pmpro_checkout-field-bemail' ).prependTo( '.pmpro_checkout-field-password' ); | |
jQuery( '.pmpro_checkout-field-firstname' ).prependTo( '.pmpro_checkout-field-password' ); | |
jQuery( '.pmpro_checkout-field-lastname' ).appendTo( '.pmpro_checkout-field-firstname' ); | |
</script> | |
<?php | |
} | |
} | |
add_action( 'wp_footer', 'pmpro_move_name_fields' ); |
This code recipe would move the Email address to the top of the checkout page before other fields
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generate username from email - https://gist.github.com/andrewlimaza/daf8890246df14cfe3d880634ddb5098#file-generate-username-from-email-pmpro-php