invp_get_the_photo_count( int|null $post_ID = null )

invp_get_the_photo_count

Description Description

Template tag. Returns the number of images attached to the vehicle post.


Top ↑

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

(int)


Top ↑

Source Source

File: includes/template-tags.php

		$image_urls = array();
		foreach ( $images as $image ) {
			foreach ( $sizes as $size ) {
				$img_element = wp_get_attachment_image(
					$image->ID,
					$size,
					false,
					array( 'class' => "attachment-$size size-$size invp-image" )
				);

				if ( '' === $img_element ) {
					continue;
				}

				$image_urls[ $size ][] = $img_element;