Made the buyer phone number clickable in the in the order backend.

This commit is contained in:
avinapatel 2017-04-26 17:48:56 +05:30
parent 34f2c66333
commit 824f13924e
2 changed files with 23 additions and 1 deletions

View File

@ -299,7 +299,16 @@ class WC_Meta_Box_Order_Data {
$field_value = $order->get_meta( '_' . $field_name );
}
echo '<p><strong>' . esc_html( $field['label'] ) . ':</strong> ' . make_clickable( esc_html( $field_value ) ) . '</p>';
switch ( $field_name ) {
case 'billing_phone' :
$field_value = wc_make_phone_clickable( esc_html( $field_value ) );
break;
default :
$field_value = make_clickable( esc_html( $field_value ) );
break;
}
echo '<p><strong>' . esc_html( $field['label'] ) . ':</strong> ' . $field_value . '</p>';
}
echo '</div>';

View File

@ -1593,3 +1593,16 @@ function wc_get_permalink_structure() {
}
return $permalinks;
}
/**
* Convert plaintext phone number to clickable phone number.
*
* @since 3.0.0
*
* @param string $text Content to convert phone number.
* @return string Content with converted phone number.
*/
function wc_make_phone_clickable( $text ) {
$phone = trim ( preg_replace( '/[\s\-\+\(\)]/', '', $text ) );
return "<a href=\"tel:$phone\">$text</a>";
}