Created
June 20, 2013 09:44
-
-
Save tridungpham/5821535 to your computer and use it in GitHub Desktop.
Add suffix to renting price
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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