Skip to content

Commit

Permalink
Do not show address title when private address fields return empty va…
Browse files Browse the repository at this point in the history
…lues via hook
  • Loading branch information
kprajapatii committed Nov 21, 2023
1 parent 037a61c commit b86bf4f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions includes/custom-fields/output-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2519,19 +2519,23 @@ function geodir_cf_address($html,$location,$cf,$p='',$output=''){
// Render private address.
$address_fields = geodir_post_address( $address_fields, 'address', $gd_post );

$plain_value = wp_strip_all_tags( $address_fields, true );
if ( $plain_value == '' ) {
return $html;
}

// Database value.
if ( ! empty( $output ) && isset( $output['raw'] ) ) {
$address_fields = str_replace("<br>","",$address_fields);
return stripslashes( wp_strip_all_tags($address_fields) );
$address_fields = str_replace( "<br>", "", $address_fields );
return stripslashes( wp_strip_all_tags( $address_fields, true ) );
}

// Stripped value.
if ( ! empty( $output ) && isset( $output['strip'] ) ) {
$address_fields = str_replace("<br>",",",$address_fields);
return stripslashes( wp_strip_all_tags($address_fields) );
$address_fields = str_replace( "<br>", ",", $address_fields );
return stripslashes( wp_strip_all_tags( $address_fields, true ) );
}

// print_r($cf);exit;
$html = '<div class="geodir_post_meta ' . $cf['css_class'] . ' geodir-field-' . $cf['htmlvar_name'] . '" itemscope itemtype="http://schema.org/PostalAddress">';

$maybe_secondary_class = isset($output['icon']) ? 'gv-secondary' : '';
Expand Down

0 comments on commit b86bf4f

Please sign in to comment.