<?php
/**
 * Template Name: Page With Sidebar
 */
get_header();

$cols = is_active_sidebar( 'sidebar' ) ? 'col-xl-9 col-lg-8 col-md-7' : 'col-md-12';
if ( have_posts() ) {
    while ( have_posts() ) {
      the_post();
    ?>
    <div class="row">
        <div class="<?php echo esc_attr( $cols ); ?>">
            <article <?php post_class( 'post single-page-inner' ); ?>>
                <div class="post-content">
                    <?php if ( has_post_thumbnail() ) : ?>
                        <div class="az-page-thumbnail"><?php the_post_thumbnail( 'full' ); ?></div>
                    <?php endif; ?>
                    <div class="az-page-inner">
                        <h1 class="post-title page-title"><?php the_title(); ?></h1>
                        <div class="entry-content clearfix">
                            <?php the_content(); ?>
                            <?php wp_link_pages(); ?>
                        </div>
                        <?php comments_template( '', true );  ?>
                    </div>
                </div>
            </article>
        </div>
        <?php if ( is_active_sidebar( 'sidebar' ) ) { ?>
        <div class="col-xl-3 col-lg-4 col-md-5 sidebar">
            <?php
                get_sidebar();
            ?>
        </div>
        <?php } ?>
    </div>
    <?php
  }
}
get_footer();
