<?php
/**
 * Related post for single page
 * @since 1.0
 * @package evaWp
 */
 $related = get_query_var('single_related_posts');
 if( $related ): ?>
 	<div class="evawp-related-post-wrapper">
 		<div class="container row">
 			<h2 class="related-title"><?php esc_html_e( 'Related Post', 'evawp' );?></h2>
 			<div class="evawp-related-post-inner-wrapper">
 				<?php foreach ( $related as $r ):?>
					<div class="evawp-related-post-inner">
						<div>
							<a href="<?php echo esc_url( get_permalink( $r->ID ) ); ?>">
								<?php if( has_post_thumbnail( $r->ID ) ): ?>
									<img src="<?php echo esc_attr( get_the_post_thumbnail_url( $r->ID, 'full' ) ); ?>">
								<?php endif; ?>			
								<div class="evawp-related-post-meta">
									<?php evawp_the_category( $r->ID ); ?>
									<a href="<?php echo esc_url( get_permalink( $r->ID ) ); ?>">
										<h3><?php echo esc_html( $r->post_title ); ?></h3>
									</a>
								</div>
							</a>
						</div>
					</div>
 				<?php endforeach; ?>
 			</div>
 		</div>
 	</div>
 <?php endif; ?>