invp_get_the_location_zip( int|null $post_ID = null )
invp_get_the_location_zip
On This Page
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
Return Return
(string)
Source Source
File: includes/template-tags.php
function invp_get_the_location_zip( $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' );
if ( empty( $location_terms ) || is_wp_error( $location_terms ) ) {
return '';
}
return get_term_meta( $location_terms[0]->term_id, 'address_zip', true );
}
Expand full source codeCollapse full source codeView on Github