invp_get_the_carfax_url_svg( int|null $post_ID = null )

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.


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


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 ) {
	$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;
}