<?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/page-title.jpg"; 
   }
?>
<?php $postID = get_queried_object_id();?>
<!-- page-title -->
    <section class="page-title" style="background-image: url(<?php echo $img;?>);">
        <div class="container">
            <div class="content-box">
                <h1 class="title"><?php the_title();?></h1>
            </div>
        </div>
    </section>
    <!-- page-title end -->
<!-- service-details -->
    <section class="service-details">
        <div class="container">
            <div class="row">
                <div class="col-lg-4 col-md-12 col-sm-12 sidebar-side">
                    <div class="service-sidebar-content">
                        <div class="sidebar-categories wow fadeInLeft" data-wow-delay="0ms" data-wow-duration="1500ms">
                            <div class="sidebar-title"><h4>Our Services</h4></div>
                            <ul class="categories-list">
                              <?php
                                  $args = array ( 
                                      'post_type'      => array( 'services' ), 
                                      'orderby'        => 'post_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();
                                      $post = get_post(get_the_ID());
                              ?>
                                <li <?php if($postID == $post->ID){?> class="active" <?php }?>>
                                <a href="<?php the_permalink();?>"><?php echo get_the_title();?></a>
                                </li>
                              <?php
                                   $i++;
                                   }
                                }
                                ?>
                            </ul>
                        </div>
                        <div class="sidebar-call centred wow fadeInLeft" data-wow-delay="300ms" data-wow-duration="1500ms">
                            <div class="icon-box"><i class="flaticon-telephone"></i></div>
                            <div class="text">Got any Questions?<br />CALL US NOW</div>
                            <h3 class="phone"><a href="tel:<?php echo html_entity_decode( get_option( 'option_8' ) );?>"><?php echo html_entity_decode( get_option( 'option_8' ) );?></a></h3>
                            <div class="email"><a href="mailto:<?php echo html_entity_decode( get_option( 'option_71' ) );?>"><?php echo html_entity_decode( get_option( 'option_71' ) );?></a></div>
                            <div class="link"><a href="<?php echo esc_url( get_permalink(14) ); ?>">Get Free Estimate</a></div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-8 col-md-12 col-sm-12 content-side">
                    <div class="service-details-content">
                        <div class="content-style-one">
                            <?php echo $content = apply_filters( 'the_content', get_post_field( 'post_content', $postID ) );?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- service-details end -->

<?php get_footer(); ?>