Made the buyer phone number clickable in the in the order backend.
This commit is contained in:
parent
34f2c66333
commit
824f13924e
|
@ -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>';
|
||||
|
|
|
@ -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>";
|
||||
}
|
Loading…
Reference in New Issue