invp_get_the_photo_url( string $size = 'medium', int|null $post_ID = null )
invp_get_the_photo_url
On This Page
Parameters Parameters
- $size
-
(string) (Optional) A thumbnail size name.
Default value: 'medium'
- $post_ID
-
(int|null) (Optional) The post ID of a vehicle. Must be passed when using this method outside the loop.
Default value: null
Return Return
(string) A URL that points to a photo
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( 'images/no-photo.svg', INVP_PLUGIN_FILE_PATH ), $post_ID ); }
Expand full source codeCollapse full source codeView on Github