<?php
/**
 * Template part for displaying posts in the Gallery format.
 *
 * Shows the featured image as preview with an image-count badge,
 * title and excerpt below.
 *
 * @package FansPaysite
 * @since   2.3
 */
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'fps-post-card fps-format-gallery' ); ?>>
	<?php if ( has_post_thumbnail() ) : ?>
		<div class="fps-post-thumbnail fps-image-full">
			<a href="<?php the_permalink(); ?>">
				<?php the_post_thumbnail( 'medium_large', array( 'class' => 'ui image rounded', 'loading' => 'lazy' ) ); ?>
			</a>
			<?php
			$images = get_post_galleries_images( get_the_ID() );
			$count  = 0;
			foreach ( $images as $gallery ) {
				$count += count( $gallery );
			}
			if ( $count > 0 ) :
			?>
				<span class="fps-gallery-count"><i class="fas fa-images"></i> <?php echo esc_html( $count ); ?></span>
			<?php endif; ?>
		</div>
	<?php endif; ?>
	<div class="fps-post-body">
		<div class="fps-format-icon"><i class="fas fa-images"></i></div>
		<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
		<?php the_excerpt(); ?>
	</div>
</article>
