<?php
			$orig_post = $post;
			global $post;
			$tags = wp_get_post_tags($post->ID);
			
			if ($tags) {
			$tag_ids = array();
			foreach($tags as $individual_tag){ $tag_ids[] = $individual_tag->term_id; }
			$args=array(
			'tag__in' => $tag_ids,
			'post__not_in' => array($post->ID),
			'posts_per_page'=>4 // Number of related posts to display.
			);
			
			$my_query = new wp_query( $args );
			?>
            <div class="wrapper" id="relatedblog">
    	<div class="container">
        	<div class="content-heading white">
    			<h2><?php _e( 'Related Posts', 'activehost');?></h2>
                <small><?php _e( 'Other Similar Posts You Might Like', 'activehost');?></small>
                <span></span>
            </div>
            <div class="row featuredposts">
            <?php
		
			while( $my_query->have_posts() ) {
			$my_query->post_count;
			$my_query->the_post();
			?>
				<div class="col-sm-<?php echo esc_html((12/$my_query->post_count)); ?>">
                	<div class="post">
                    	<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                        <h2><?php the_title(); ?></h2>
                        <small><?php _e( 'Author: ', 'activehost');?><?php the_author();?></small> 
                        <div class="post-image"><?php the_post_thumbnail(); ?><span><i class="glyphicon glyphicon-calendar"></i><?php the_time('jS M'); ?></span></div>
                        <?php the_excerpt(); ?>
                    </div>
                </div>
				
                <?php }?>
                            </div> 
		</div>
    </div>
				<?php }
				$post = $orig_post;
				wp_reset_query();
				?>
