invp_get_the_location( int|null $post_ID = null )

Template tag. Returns the address where this vehicle is located. Address may contain line break characters.


Description

The location taxonomy terms contain full street addresses in the term description.


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


Return

(string)


Source

File: includes/template-tags.php

function invp_get_the_location( $post_ID = null ) {
	if ( empty( $post_ID ) ) {
		$post_ID = get_the_ID();
	}

	/**
	 * We want the term description from the location taxonomy term
	 * because the meta key/term name only contains street address line one.
	 */
	$location_terms = wp_get_post_terms( $post_ID, 'location' );
	return implode( ', ', array_column( $location_terms, 'description' ) );
}