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

invp_get_the_fuel_economy_value


Description Description

Makes retrieving a fuel economy data point from metadata easier.


Top ↑

Parameters Parameters

$key

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

$fuel_type

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

Default value: 1


Top ↑

Return Return

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


Top ↑

Source Source

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_' . $key;
	}
	else
	{
		$key = 'fuel_economy_' . $fuel_type . '_' . $key;
	}

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