Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
updated uc-people-widget.php. If a phone number is displayed we now d…
…o a str_replace on hyphens to make them non-break hyphens
  • Loading branch information
Zurawel committed Sep 5, 2018
1 parent cb7dc94 commit a70c8a1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion uc-people-widget.php
Expand Up @@ -36,12 +36,13 @@ Class UC_People_Widget extends WP_Widget {
private function createTextCell( $field, $information_to_display, $id ){
$cell = '';
if (in_array($field, $information_to_display)) {
$cell .= '<td class="person-'.$field.'">'.get_field($field, $id ).'</td>';
//$cell .= '<td class="person-'.$field.'">'.get_field($field, $id ).'</td>';
}
return $cell;
}

private function get_people_grid( $args, $information_to_display ){

$the_query = new WP_Query( $args );
$out = '';
if( $the_query->have_posts() ){
Expand Down Expand Up @@ -196,6 +197,10 @@ Class UC_People_Widget extends WP_Widget {
$out .= '</td>';
} else if( $f == 'mailing_address' && in_array('mailing_address', $information_to_display) ){
$out .= '<td class="person-'.$f.'">'.str_replace(';','<br>',get_field($f, $id )).'</td>';
// If the value($f) is a phone number than we should replace any hyphens with the html entity for a non-break hyphen (&#8209;)
} elseif ($f == 'phone' && in_array('phone', $information_to_display) ) {
$phoneStrReplace = str_replace('-', '&#8209;', get_field('phone', $id ));
$out .= '<td>'.$phoneStrReplace.'</td>';
} elseif( $f == 'url' && in_array( 'url', $information_to_display ) ){
$out .= '<td class="person-url"><a href="'.get_field('url', $id ).'">'.get_field('url', $id ).'</a>'.'</td>';
} else {
Expand Down

0 comments on commit a70c8a1

Please sign in to comment.