<?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
//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/breatcome_bg.jpg"; 
   } 
?>
<!-- Start 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();?></li>
               </ul>
            </div>
         </div>
      </div>
   </div>
</div>
<!-- End Breadcrumbs -->
<!-- Our Conditions Start -->
<div class="servicepage" id="conditions">
   <div class="container">
      <div class="row">
         <div class="col-lg-12 col-md-12 col-sm-12 col-12 text-center">
            <div class="section-heading">
               <h2><?php the_content();?></h2>
            </div>
         </div>
         <?php
            $args = array ( 
                'post_type'      => 'condition',
                '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-3 col-md-4 col-sm-6 col-12">
                <div class="conditext d-flex align-items-center justify-content-center">
                   <p><?php echo get_the_title();?></p>
                </div>
             </div>
         <?php
             $i++;
            }
          }wp_reset_postdata();
          ?>
      </div>
   </div>
</div>
<!-- Our Conditions End -->
<?php get_footer(); ?>