invp_get_the_photo_url( $size = 'medium', int $post_ID = null )

invp_get_the_photo_url


Parameters Parameters

$post_ID

(int) (Optional)

Default value: null


Top ↑

Return Return

(string) A URL that points to a photo


Top ↑

Source Source

File: includes/template-tags.php

function invp_get_the_photo_url( $size = 'medium', $post_ID = null )
{
	if( empty( $size ) )
	{
		$size = 'medium';
	}

	if( empty( $post_ID ) )
	{
		$post_ID = get_the_ID();
	}

	$thumbnail_id = get_post_thumbnail_id( $post_ID, $size );
	if( ! is_wp_error( $thumbnail_id ) && ! empty( $thumbnail_id ) )
	{
		return wp_get_attachment_url( $thumbnail_id );
	}

	return apply_filters( 'invp_no_photo_url', plugins_url( 'assets/no-photo.svg', INVP_PLUGIN_FILE_PATH ), $post_ID );	
}