invp_get_the_odometer( string $append = '', int $post_ID = null )
invp_get_the_odometer
Contents
Description Description
Template tag. Returns the odometer formatted as a number with comma separators if it is numeric. Returns any other non-zero value without any formatting. Adds the $append value to any return value but an empty string.
Parameters Parameters
- $append
-
(string) (Optional) A string to append after the odometer value. If the vehicle has no odometer value, then this parameter is ignored.
Default value: ''
- $post_ID
-
(int) (Optional)
Default value: null
Return Return
(string)
Source Source
File: includes/template-tags.php
function invp_get_the_odometer( $append = '', $post_ID = null ) { $raw = INVP::get_meta( 'odometer', $post_ID ); if( '0' == $raw ) { return ''; } $odometer = ''; if( is_numeric( $raw ) ) { $odometer .= number_format( $raw, 0, '.', ',' ); } else { $odometer .= $raw; } if( empty( $odometer ) ) { return ''; } //Did the user pass a string to append? if( $append ) { $odometer .= $append; } return $odometer; }
Expand full source code Collapse full source code View on Github