Last active
July 19, 2018 20:33
-
-
Save dparker1005/dd13edd52605129cdacb93263a45ce60 to your computer and use it in GitHub Desktop.
Formats address in Members List page for international addresses (i.e. Zip City) without looking at the State field
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 | |
//Add from here down to the bottom of your PMPro Customizations plugin | |
add_action('pmpro_formatted_address', 'pmpro_custom_members_list_address', 10, 9); | |
function pmpro_custom_members_list_address( $address, $name, $address1, $address2, $city, $state, $zip, $country, $phone ) { | |
$address = ''; | |
if ( ! empty( $name ) ) { | |
$address .= $name . '<br/>'; | |
} | |
if ( ! empty( $address1 ) ) { | |
$address .= $address1 . '<br/>'; | |
} | |
if ( ! empty( $address2 ) ) { | |
$address .= $address2 . '<br/>'; | |
} | |
if ( ! empty( $zip ) ) { | |
$address .= $zip; | |
if ( ! empty( $city ) ) { | |
$address .= ' ' . $city; | |
} | |
$address .= '<br/>'; | |
} elseif ( ! empty( $city ) ) { | |
$address .= $city . '<br/>'; | |
} | |
if ( ! empty( $country ) ) { | |
$address .= $country . '<br/>'; | |
} | |
if ( ! empty( $phone ) ) { | |
$address .= formatPhone( $phone ); | |
} | |
return $address; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment