Cambio de currency simbol (USD y $ dependiendo el tipo de listing)
//Archivo dentro del plugin Realty Portal Listing
// includes/property/library/
//Linea 434
public function get_price() {
$price = trim( get_post_meta( $this->ID, 'price', true ) );
//Agregue un argumento mas en el rp_format_price que es el ID para que dentro de la funcion
//capture que tipo de listing es y haga el cambio de USD y $
$price = ( preg_match( "/^([0-9]+)$/", $price ) ) ? rp_format_price( $price,true,$this->ID) : esc_html( $price );
return apply_filters( 'rp_get_price', $price );
}
public function get_price_html() {
if($this->get_price()):
//Se agrego volcar en una clase el listing type
$listing_type = get_the_terms( $this->ID,'listing_type');
$before_price = '<div class="property-price '.$listing_type[0]->name.'"><span class="before-price">' . esc_html( get_post_meta( $this->ID, 'before_price', true ) ) . '</span>';
$before_price = apply_filters( 'rp_before_get_price_html', $before_price );
$after_price = '<span class="after-price">' . esc_html( get_post_meta( $this->ID, 'after_price', true ) ) . '</span></div>';
$after_price = apply_filters( 'rp_after_get_price_html', $after_price );
return apply_filters( 'rp_get_price_html', $before_price . ' ' . $this->get_price() . ' ' . $after_price );
endif;
}
//Archivo dentro del plugin Realty Portal Listing
// includes/property/library/
//Linea 675
/**
* This function get format price
* EDIT: se agrego un argumento mas el post_id
* @param $price
* @param bool $html
*
* @return mixed|string|void
*/
function rp_format_price( $price, $html = true,$post_id = '') {
$currency_code = RP_Property::get_setting( 'property_setting', 'property_currency', 'USD' );
//EDITADO, del ID pasado como argumento extraigo el tipo de listing que es y trasformo el currency simbol
if($post_id !== ''){
$tax = get_the_terms($post_id,'listing_type');
if($tax[0]->name == 'Venta'){
$currency_symbol = 'U$D';
} else if($tax[0]->name == 'Alquiler') {
$currency_symbol = '$';
} else {
$currency_symbol = rp_currency_symbol( $currency_code );
}
} else {
$currency_symbol = rp_currency_symbol( $currency_code );
}