Skip to content

Instantly share code, notes, and snippets.

@tridungpham
Created June 20, 2013 09:44
Show Gist options
  • Save tridungpham/5821535 to your computer and use it in GitHub Desktop.
Save tridungpham/5821535 to your computer and use it in GitHub Desktop.
Add suffix to renting price
<?php
static function format_price( $price = '', $no_price_text = 'Contact for price' ) {
/**
* @var PGL_Options $pgl_options
*/
global $pgl_options;
if ( ! $price ) {
return apply_filters( 'estate/format_price/noprice', $no_price_text );
}
else {
$symbol = PGL_Utilities::get_currency_symbol( $pgl_options->option( 'estate_currency' ) );
global $post;
$suffix = '';
if (get_post_meta( $post->ID, 'estate_purpose', TRUE ) === 'rent') {
$suffix = ' per Month';
}
return apply_filters( 'estate/format_price', ( $pgl_options->option( 'estate_currency_placement' ) == 'before' ) ? $symbol . ' ' . number_format( $price, 0, '.', ',' ) . $suffix : number_format( $price, 0, '.', ',' ) . ' ' . $symbol . $suffix);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment