<?php /*template name: List Sub Pages*/ get_header(); ?>
<div class="uk-cover-container banner uk-margin-large-bottom">
    <canvas class="uk-visible@m" width="" height="200"></canvas>
    <canvas class="uk-hidden@m" width="" height="200"></canvas>
	
	<img uk-img data-src="<?php echo get_template_directory_uri(); ?>/images/comfortable-counselling-office.webp" data-width data-height uk-cover>
	<div class="uk-overlay-primary uk-position-cover"></div>
	<div class="uk-container uk-container-large uk-position-cover uk-flex uk-flex-center uk-flex-middle">
		<div class="uk-text-center">
			<img class="shrink-2" uk-img data-src="<?php echo get_template_directory_uri(); ?>/images/branches-icon.png" data-width data-height>
			<h1 class="white uk-margin-remove"><?php the_title(); ?></h1>
		</div>
	</div>
</div>
<div class="uk-container uk-container-large">
	<main role="main">
		<section>
			
			<?php if (have_posts()): while (have_posts()) : the_post(); ?>

				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

					<?php the_content(); ?>
					
					<div class="uk-child-width-1-3@m uk-flex uk-flex-center uk-text-center uk-grid-small uk-margin-large-top" uk-grid> 
						
						<?php
						$id = get_the_ID();
						$args = array(
							'post_type'      => 'page',
							'posts_per_page' => -1,
							'post_parent'    => $id,
							'order'          => 'ASC',
							'orderby'        => 'menu_order'
						 );


						$parent = new WP_Query( $args );

						if ( $parent->have_posts() ) : ?>

							<?php while ( $parent->have_posts() ) : $parent->the_post(); ?>
							
							<div>
								<div id="parent-<?php the_ID(); ?>" class="parent-page uk-text-center">
									<div class="uk-inline-clip">
										<div class="uk-text-center banner_small">
											<a href="<?php the_permalink(); ?>"><img class="uk-transition-scale-up uk-transition-opaque" src="<?php the_post_thumbnail_url('full'); ?>"></a>
											<div class="">
												<h4 class="brown uk-text-bold"><?php the_title(); ?></h4>
											</div>
										</div>
									</div>
									<div class="uk-text-center uk-margin">
										<?php html5wp_excerpt('html5wp_index'); ?>
									</div>
								</div>
							</div>
	

							<?php endwhile; ?>

						<?php endif; wp_reset_postdata(); ?>
					
					</div>

					<br class="clear">
					<p class="uk-text-right"><?php edit_post_link( __('Edit this page'), '', '', 0, 'post-edit-link uk-text-large uk-padding-small uk-button-large uk-button uk-button-primary' ); ?></p>
				</article>

			<?php endwhile; ?><?php endif; ?>

		</section>
	</main>
</div>
<?php get_footer(); ?>
