<div id="core" class="container_alt page template_page">
	 <div class="news_posts">
	
	<div class="single_practice">
		<div class="main_img">
			<?php echo get_the_post_thumbnail( 97, 'full' ); ?>
			</div>
			<?php while ( have_posts() ) : the_post();?>
		
      <?php $page_url =  site_url();?>
			<div class="inner-page-section2">
				<div class="container">
					<div class="news-detail-bx">
								<div class="left_column">
									<span class="gen_heading">News</span>
										<?php $args = array(
										'post_type' => 'post',
										'posts_per_page' => '5',
										'order' => 'DESC'
										);
										  $my_posts = new WP_Query( $args );
										   $current_url = home_url(add_query_arg(array(), $wp->request));
										 // echo "==<br/>";
										 
										  ?>
										 <?php while ( $my_posts->have_posts() ) : $my_posts->the_post() ?>
										 <?php
										   $post_url = get_permalink();
										//  echo "<br/>";
										  $active_class = ($current_url."/" == $post_url )?'active':'';
										 ?>
										  <div class="latest_news">
										  	<a href="<?php the_permalink();?>"><span class="gen_title <?php echo $active_class; ?>"> <?php the_title();?> </span> 
										  	<span class="arrow"><img src="<?php echo  bloginfo('template_url');?>/assets/images/news-arrow.svg"></span></a>
										  </div>
										  <?php endwhile;?>
										  <?php wp_reset_query();?>
										 <a href="<?php echo site_url();?>/news" class="news-button">All NEWS </a>
								</div>
								<div class="right_column">
						   			<h1 class="sub-heading"><?php the_title();?></h1>
						   			<div class="news_date"><?php the_date();?></div>
									<p><?php the_content();?></p>
									<p class="news_image"><?php the_post_thumbnail( 'full' );?></p>
							</div>
					</div>
			</div>
		</div>

			<?php  endwhile; 
			 wp_reset_query();?>	
		</div>
</div>
<script type="text/javascript">
	$(function() {
    $( '.left_column .latest_news' ).on( 'click', function() {
          $( this ).parent().find( '.latest_news.active' ).removeClass( 'active' );
          $( this ).addClass( 'active' );
    });
});

// var selector = '.left_column .latest_news';
// 	var url = window.location.href;
// 	var target = url.split('/');
// 	$(selector).each(function(){
// 	if($(this).find('a').attr('href')===('/'+target[target.length-1])){
// 	  $(selector).removeClass('active');
// 	  $(this).removeClass('active').addClass('active');
// 	}
// });
</script>
