<?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."images/background/inner-banner-bg-1-1.jpg"; 
   }
?>

<section class="inner-banner bg-repeat-no bg-pos-center-center bg-coveer-sz" style="background-image: url(<?php echo $img;?>);">
   <div class="container">
      <h2 class="inner-banner__title"><?php the_title();?></h2>
      <!-- /.inner-banner__title -->
      <ul class="thm-breadcrumb">
         <li class="thm-breadcrumb__item"><a class="thm-breadcrumb__link" href="<?php echo esc_url( home_url( '/' ) ); ?>">Home</a></li>
         <li class="thm-breadcrumb__item current"><a class="thm-breadcrumb__link" href="#"><?php the_title();?></a></li>
      </ul>
      <!-- /.thm-breadcrumb -->
   </div>
   <!-- /.container -->
</section>
<!-- /.inner-banner -->
<section class="container" id="recentwork">
   <?php echo get_the_content();?>
   <div class="row gallery">
        <?php if(have_rows('works')): ?>
        <?php $i=0; while(have_rows('works')): ?>
        <?php the_row(); ?>
      <div class="col-lg-4 col-md-6 col-sm-12 thumb hvr-bob">
         <div class="project_gallery">
            <a href="<?php the_sub_field('image'); ?>">
               <figure><img class="img-fluid img-thumbnail" src="<?php the_sub_field('image'); ?>" alt="Random Image"></figure>
            </a>
            <div class="blog-two__content-block">
               <div class="blog-two__date">
                  <i class="fas fa-pencil-ruler"></i>
               </div>
               <!-- /.blog-two__date -->
               <div class="blog-two__content">
                  <h3 class="blog-two__title"><a href="#"><?php the_sub_field('title'); ?></a></h3>
                  <!-- /.blog-two__title -->
                  <p class="blog-two__author"> <a href="#" class="blog-two__author-link"><i class="fas fa-map-marker-alt"></i><?php the_sub_field('address'); ?></a></p>
               </div>
            </div>
         </div>
      </div>
      <?php $i++; endwhile; ?>
      <?php endif; ?>
   </div>
</section>
<?php get_footer(); ?>