<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> aria-label="post-<?php the_ID(); ?>">
	<?php
		global $wp_query;
		global $passport_template_name;

		$gallery_active		= get_post_meta( get_the_ID(), 'g_active', true );
		$gallery_no_content = get_post_meta( get_the_ID(), 'g_no_content', true );
		$gallery_type		= get_post_meta( get_the_ID(), 'g_type', true ); 
		
		/*Define the attachment id of Home page*/
		$frontpage_id		= get_option( 'page_on_front' );
		$attachment_id		= get_post_thumbnail_id( $frontpage_id );	

	?>

	<!-- Show sticky post -->
	<?php get_template_part( 'partials/partials', 'sticky-posts' ); ?> 

	<!-- Gallery active, show gallery post format -->
	<?php if ( 'on' == $gallery_active && 'publish' === get_post_status() ) : ?>
		<?php if ( "template-medium-image.php" == $passport_template_name || is_search() || is_category() || is_date() || is_tag() || is_author() ) : ?>
			<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 post-media enlarge">
		<?php else : ?>
			<div class="post-media"> 
		<?php endif; ?>
		        <?php echo passport_display_gallery_post_format(); ?>
		<?php if ( "template-medium-image.php" == $passport_template_name || is_search() || is_category() || is_date() || is_tag() || is_author() ) : ?>
	        </div>
		<?php else : ?>
		    </div>
		<?php endif; ?>
		<?php endif; ?>

	<!-- Gallery inactive, show the post thumbnail -->
	<?php if ( 'on' != $gallery_active && ( has_post_thumbnail() || 0 != $attachment_id ) && 'publish' === get_post_status() ) : ?>
		<?php if ( "template-medium-image.php" == $passport_template_name || is_search() || is_category() || is_date() || is_tag() || is_author() ) : ?>
			<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6 post-media enlarge">
		<?php else : ?>
			<div class="post-media"> 
		<?php endif; ?>
            <?php if ( is_single() ) : ?>
                 <?php echo passport_display_gallery_post_format(); ?>
            <?php else: ?>
			    <?php get_template_part( 'partials/partials', 'image' ); ?>
            <?php endif; ?>
		<?php if ( "template-medium-image.php" == $passport_template_name || is_search() || is_category() || is_date() || is_tag() || is_author() ) : ?>
			</div>
		<?php else : ?>
			</div>
		<?php endif; ?>
	<?php endif; ?>

	<!-- Show header, meta and the content -->
	<?php if ( 'on' !== $gallery_no_content && 'publish' === get_post_status() ) : ?>
		<?php if ( "template-medium-image.php" == $passport_template_name || is_search() || is_category() || is_date() || is_tag() || is_author() ) : ?>
			<div class="<?php if( has_post_thumbnail() || 0 != $attachment_id || 'on' == $gallery_active ) { echo 'col-xs-12 col-sm-12 col-md-6 col-lg-6'; } else { echo 'col-xs-12 col-sm-12 col-md-12 col-lg-12'; } ?>">
		<?php else : ?>
			<div class="post-content"> 
		<?php endif;?>
		<?php
			get_template_part( 'partials/partials', 'header' ); 
			get_template_part( 'partials/partials', 'content' );
		?>
		<?php if ( "template-medium-image.php" == $passport_template_name || is_search() || is_category() || is_date() || is_tag() || is_author() ) : ?>
			</div>
		<?php else : ?>
			</div>
		<?php endif; ?>
	<?php endif; ?>
</article>
