invp_get_the_transmission( int|null $post_ID = null )

invp_get_the_transmission


Parameters Parameters

$post_ID

(int|null) (Optional) The post ID of a vehicle. Must be passed when using this method outside the loop.

Default value: null


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/template-tags.php

function invp_get_the_transmission( $post_ID = null ) {
	if ( empty( $post_ID ) ) {
		$post_ID = get_the_ID();
	}
	$raw = INVP::get_meta( 'transmission', $post_ID );

	/**
	 * If we have transmission speeds "6" and transmission string
	 * "Automatic", change the string to "6 Speed Automatic"
	 */
	if ( ! empty( invp_get_the_transmission_speeds( $post_ID ) ) ) {
		$prefix = sprintf(
			'%s %s',
			invp_get_the_transmission_speeds( $post_ID ),
			__( 'Speed', 'inventory-presser' )
		);

		if ( false === strpos( $raw ?? '', $prefix ) ) {
			$raw = sprintf(
				'%s %s',
				$prefix,
				$raw
			);
		}
	}

	return $raw;
}