<?php 
		global $post;
		$categories = get_the_category($post->ID);								
		$category_ids = array();
		foreach($categories as $individual_category) {$category_ids[] = $individual_category->term_id;}
		if ($categories) {
	?>
<div class="single-relate">
		<div class="row-fluid">
			<?php
				  $args=array(
					'category__in' => $category_ids,
					'post__not_in' => array($post->ID),
					'showposts'=>4,
					'orderby'	=> 'rand',	
					'ignore_sticky_posts'=>1
				   );
				$related_term = new WP_Query($args);
				while($related_term -> have_posts()):$related_term -> the_post();
			?>
			<div class="span3">
				<div class="hcat-content">
					<div class="hcat-img" onclick="window.location='<?php the_permalink();?>';">
						<?php if (has_post_thumbnail()){?>
							<a href="<?php the_permalink();?>" title="<?php the_title_attribute();?>"><?php the_post_thumbnail('thumbnail');?></a>
						<?php }else{?>
							<a href="<?php the_permalink();?>" title="<?php the_title_attribute();?>"><img src="<?php echo get_template_directory_uri();?>/assets/img/no-thumbnail.png" alt="No Thumb"/></a>
						<?php } ?>
						<div class="bg-hover">
							<p><?php echo get_the_time('F j, Y');?></p>
							<p><?php if(get_comments_number() <= 1){echo get_comments_number().' Comment';}else{echo get_comments_number().' Comments';}?></p>
						</div>
						<div class="hcat-hover"></div>
					</div>
					<div class="hcat-detail">
						<h4><a href="<?php the_permalink();?>" title="<?php the_title_attribute();?>"><?php the_title();?></a></h4>
						<p></p>
					</div>
				</div>
			</div>
			<?php
				endwhile;
				wp_reset_postdata();
			?>
		</div>
	</div>
	<?php }?>
