I am trying to write a function such that if the price is not zero it should check that the variable price_label_before is zero, then if should return a certain format or else return something else.
E.g 1
price_label_before =USD
Currency= KES
Price=2000
Return USD 2000
E.g 2
price_label_before= null
Currency= KES
Price=2000
Return KES 2000
Below is the code:
$currency = esc_html( get_option('wp_estate_currency_symbol', '') );
$where_currency = esc_html( get_option('wp_estate_where_currency_symbol', '') );
$price_label_before = floatval ( get_post_meta($post_id, 'property_label_before', true) );
$price = floatval ( get_post_meta($post_id, 'property_price', true) );
if ($price != 0 ) {
if ($price_label_before = 0) {
$price =wpestate_show_price($post_id,$currency,$where_currency,1);
}
else {
$myprice = floatval ( get_post_meta($post_id, 'property_price', true) );
$price='<span class="price_label price_label_before1">'.$price_label_before. ' ' .number_format($myprice).'</span><span class="price_label ">'.$price_label.'</span>';
}
}else{
$price='';
}