Skip to content

Instantly share code, notes, and snippets.

@ronalfy
Last active July 31, 2020 14:07
Show Gist options
  • Save ronalfy/a0f0a8ee71d7ac3e9dad8e523ce65f8e to your computer and use it in GitHub Desktop.
Save ronalfy/a0f0a8ee71d7ac3e9dad8e523ce65f8e to your computer and use it in GitHub Desktop.
Paid Memberships Pro - Move State field Above Phone Number in Checkout
<?php
/**
* This recipe moves the state field above the phone number during 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 pmpro_custom_state_field_above_phone_number() {
if ( ! is_page( 'membership-checkout' ) ) {
return;
}
?>
<script>
jQuery( '.pmpro_checkout-field-scountry' ).appendTo( '.pmpro_checkout-field-szipcode' );
</script>
<?php
}
add_action( 'wp_footer', 'pmpro_custom_state_field_above_phone_number' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment