Forked from ipokkel/reorder-names-email-password-checkout-fields.php
Last active
May 13, 2025 13:25
-
-
Save davidmutero/1c52c19fbb23e76d3e93ee4517a588d2 to your computer and use it in GitHub Desktop.
Reorder PMPro checkout fields to Email and Password. #pmpro #paid-memberships-pro #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 | |
/** | |
* This recipe moves the checkout fields to appear in the order of | |
* 1. Email | |
* 2. Password. | |
* | |
* Email fields will be moved (always) to before password fields | |
* on the checkout page. | |
* | |
* 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_reorder_fields_names_email_password() { | |
global $pmpro_pages; | |
if ( is_page( $pmpro_pages['checkout'] ) ) { | |
?> | |
<script> | |
jQuery(document).ready(function(){ | |
var cols = jQuery('.pmpro_cols-2'); | |
if (cols.length >= 2) { | |
cols.eq(1).insertBefore(cols.eq(0)); | |
} | |
}); | |
</script> | |
<?php | |
} | |
} | |
add_action( 'wp_footer', 'my_pmpro_reorder_fields_names_email_password' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment