invp_get_the_carfax_url_svg( int $post_ID = null )

invp_get_the_carfax_url_svg


Description Description

Returns a URL to an SVG image button that users click to view Carfax reports or empty string. Sometimes the URL points to an SVG hosted on carfax.com, sometimes it's an SVG bundled with this plugin.


Top ↑

Parameters Parameters

$post_ID

(int) (Optional)

Default value: null


Top ↑

Return Return

(string) A URL to an SVG image or empty string


Top ↑

Source Source

File: includes/template-tags.php

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

	$url = INVP::get_meta( 'carfax_url_icon', $post_ID );

	/**
	 * If we don't have a URL from Carfax IICR, or the user has turned off the
	 * newer, dynamic icons, fall back to SVGs that ship with this
	 * plugin.
	 */
	if( empty( $url ) || ! INVP::settings()['use_carfax_provided_buttons'] )
	{
		//fallback to the icon that ships with this plugin
		$url = plugin_dir_url( INVP_PLUGIN_FILE_PATH ) . '/images/show-me-carfax';
		if( invp_is_carfax_one_owner( $post_ID ) )
		{
			$url .= '-1-owner';
		}
		$url .= '.svg';
	}

	return $url;
}