invp_get_the_odometer( string $append = '', int $post_ID = null )

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

$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) The post ID of a vehicle. Must be passed when using this method outside the loop.

Default value: null


Return

(string)


Source

File: includes/template-tags.php

 * @return string
 */
function invp_get_the_odometer( $append = '', $post_ID = null ) {
	$raw = INVP::get_meta( 'odometer', $post_ID );
	if ( '0' === $raw ) {
		return apply_filters( 'invp_get_the_odometer', '', $post_ID );
	}

	$odometer = '';
	if ( is_numeric( $raw ) ) {
		$odometer .= number_format( $raw, 0, '.', ',' );
	} else {
		$odometer .= $raw;
	}

	if ( empty( $odometer ) ) {
		return apply_filters( 'invp_get_the_odometer', '', $post_ID );
	}

	// Did the user pass a string to append?
	if ( $append ) {
		$odometer .= $append;
	}