<?php
   if ( ! defined( 'ABSPATH' ) ) {
     exit; // Exit if accessed directly
   }
?>

<?php get_header(); ?>
<?php $template_url = get_bloginfo ( 'template_url' ) . '/'; ?>
<?php 
   //to check if there is a post regarding the url access the page
   if (have_posts ()) :
     the_post(); 
   endif;
   $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID), 'thumbnail' );
   if($url != "")
   {
   $img = $url; 
   }else{
   $img = $template_url."img/teambg.jpg"; 
   }
?>
<!-- Breadcrumbs -->
<div class="breadcrumbs overlay" style="background-image:url(<?=$img?>)">
	<div class="container">
		<div class="bread-inner">
			<div class="row">
				<div class="col-12">
					<h2><?php the_title();?></h2>
					<ul class="bread-list">
						<li><a href="<?php echo esc_url( home_url( '/' ) ); ?>">Home</a></li>
						<li><i class="icofont-simple-right"></i></li>
						<li class="active"><?php the_title();?>aqaqaqaqqa</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- End Breadcrumbs -->
<section class="doctor-area ptb-100" id="teambreadcrumb">
   <div class="container">
      <div class="row justify-content-center">
         <div class="col-md-12 col-sm-12 col-12">
            <div class="section-title">
               <span><?php the_title();?></span>
               <?php the_content();?>
            </div>
         </div>
         <div class="col-md-12 col-sm-12 col-12">
            <div class="row justify-content-center">
               <?php
                $args = array ( 
                    'post_type'      => 'team',
                    'post_status'    => 'publish',  
                    'orderby' => 'publish_date',
                    'order' => 'DESC',  
                    'posts_per_page' => -1
                );
                $query = new WP_Query($args);
                $post_count = $query->post_count;
                if ( $query->have_posts() ){
                $i = 1;
                  while ( $query->have_posts() ){
                   
                    
                    $query->the_post();
                $img_url = get_the_post_thumbnail_url( get_the_ID(),'full');
                $post = get_post(get_the_ID());
                $the_cat = get_the_category(get_the_ID());
                $cat_name = $the_cat[0]->name;
                    
           ?>
           <div class="col-lg-4 col-md-6 col-sm-6 col-12">
                <div class="team_con">
                  <div class="box">
                    <img src="<?php echo $img_url;?>">
                  </div>
                  <h3 class="title"><?php echo get_the_title();?></h3>
                  <h4>(<?php echo get_the_excerpt();?>)</h4>
					<a href="<?php the_permalink();?>" class="readmore">Read More</a>
                </div>
              </div>
          <?php
               $i++;
              }
            }wp_reset_postdata();
            ?>
            </div>
         </div>
      </div>
   </div>
</section>
<?php get_footer(); ?>