invp_get_the_fuel_economy_value( string $key, int $fuel_type = 1, int|null $post_ID = null )

Makes retrieving a fuel economy data point from metadata easier.



(string) (Required) One of these fuel economy member suffixes: name, annual_consumption, annual_cost, annual_emissions, combined_mpg, city_mpg, highway_mpg.


(int) (Optional) Specifies which of the two fuel types from which to retrieve the value.

Default value: 1


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

Default value: null


(string) The meta value string corresponding to the provided $key or empty string.


File: includes/template-tags.php

function invp_get_the_fuel_economy_value( $key, $fuel_type = 1, $post_ID = null ) {
	if ( empty( $post_ID ) ) {
		$post_ID = get_the_ID();

	 * The meta key fuel_economy_five_year_savings does not apply to either fuel
	 * type, so ignore $fuel_type when this key is passed.
	if ( 'fuel_economy_five_year_savings' !== $key ) {
		$key = 'fuel_economy_' . $fuel_type . '_' . $key;

	return INVP::get_meta( $key, $post_ID );